Skip to content

Commit 028e6ed

Browse files
authored
Make objects pickable by removing the _client attribute (pyrogram#526)
1 parent e39ebde commit 028e6ed

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

pyrogram/types/object.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -95,3 +95,8 @@ def __getitem__(self, item):
9595

9696
def __setitem__(self, key, value):
9797
setattr(self, key, value)
98+
99+
def __getstate__(self):
100+
new_dict = self.__dict__.copy()
101+
new_dict.pop("_client", None)
102+
return new_dict

0 commit comments

Comments
 (0)