mirror of
https://github.com/LonamiWebs/Telethon.git
synced 2024-11-26 11:23:46 +03:00
Don't disconnect on del if already disconnected/loop closed
This commit is contained in:
parent
72835dfb44
commit
a46a45d060
|
@ -309,6 +309,9 @@ class TelegramBaseClient(abc.ABC):
|
|||
await self._updates_handle
|
||||
|
||||
def __del__(self):
|
||||
if not self.is_connected() or self.loop.is_closed():
|
||||
return
|
||||
|
||||
# Python 3.5.2's ``asyncio`` mod seems to have a bug where it's not
|
||||
# able to close the pending tasks properly, and letting the script
|
||||
# complete without calling disconnect causes the script to trigger
|
||||
|
|
Loading…
Reference in New Issue
Block a user