mirror of
https://github.com/LonamiWebs/Telethon.git
synced 2025-06-18 02:56:39 +00:00
Assert properties exist on disconnect
This commit is contained in:
parent
1da0018a5d
commit
9971145721
@ -291,10 +291,13 @@ class TelegramBaseClient(abc.ABC):
|
|||||||
"""
|
"""
|
||||||
Disconnects from Telegram.
|
Disconnects from Telegram.
|
||||||
"""
|
"""
|
||||||
|
# All properties may be ``None`` if `__init__` fails, and this
|
||||||
|
# method will be called from `__del__` which would crash then.
|
||||||
|
if self._sender:
|
||||||
await self._sender.disconnect()
|
await self._sender.disconnect()
|
||||||
if self._updates_handle:
|
if self._updates_handle:
|
||||||
await self._updates_handle
|
await self._updates_handle
|
||||||
|
if self.session:
|
||||||
self.session.close()
|
self.session.close()
|
||||||
|
|
||||||
def __del__(self):
|
def __del__(self):
|
||||||
|
Loading…
Reference in New Issue
Block a user