mirror of
https://github.com/LonamiWebs/Telethon.git
synced 2025-06-17 18:46:40 +00:00
Avoid memory cycle in Forward
This commit is contained in:
parent
b6b4ea669d
commit
80c9c5dad3
@ -24,7 +24,10 @@ class Forward(ChatGetter, SenderGetter):
|
|||||||
in the original :tl:`MessageFwdHeader`.
|
in the original :tl:`MessageFwdHeader`.
|
||||||
"""
|
"""
|
||||||
def __init__(self, client, original, entities):
|
def __init__(self, client, original, entities):
|
||||||
self.__dict__ = original.__dict__
|
# Copy all the fields, not reference! It would cause memory cycles:
|
||||||
|
# self.original_fwd.original_fwd.original_fwd.original_fwd
|
||||||
|
# ...would be valid if we referenced.
|
||||||
|
self.__dict__ = dict(original.__dict__)
|
||||||
self._client = client
|
self._client = client
|
||||||
self.original_fwd = original
|
self.original_fwd = original
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user