From 9eabca698739fc37a3a5d31e152a1cfe6d67cc48 Mon Sep 17 00:00:00 2001 From: Lonami Exo Date: Fri, 22 Mar 2019 18:20:02 +0100 Subject: [PATCH] Fix run_until_disconnected's call to disconnect --- telethon/client/auth.py | 3 ++- telethon/client/updates.py | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/telethon/client/auth.py b/telethon/client/auth.py index 36afc343..b6add62c 100644 --- a/telethon/client/auth.py +++ b/telethon/client/auth.py @@ -550,7 +550,8 @@ class AuthMethods(MessageParseMethods, UserMethods): return await self.start() def __exit__(self, *args): - self.disconnect() # It's also syncified, like start() + # No loop.run_until_complete; it's already syncified + self.disconnect() async def __aexit__(self, *args): await self.disconnect() diff --git a/telethon/client/updates.py b/telethon/client/updates.py index 6b85de7a..2c409735 100644 --- a/telethon/client/updates.py +++ b/telethon/client/updates.py @@ -37,7 +37,8 @@ class UpdateMethods(UserMethods): except KeyboardInterrupt: pass finally: - self.loop.run_until_complete(self.disconnect()) + # No loop.run_until_complete; it's already syncified + self.disconnect() def on(self, event): """