mirror of
https://github.com/LonamiWebs/Telethon.git
synced 2025-08-08 04:52:30 +00:00
Raise RuntimeError on with blocks that need async
This commit is contained in:
@@ -483,6 +483,12 @@ class AuthMethods(MessageParseMethods, UserMethods):
|
||||
# region with blocks
|
||||
|
||||
def __enter__(self):
|
||||
if self._loop.is_running():
|
||||
raise RuntimeError(
|
||||
'You must use "async with" if the event loop '
|
||||
'is running (i.e. you are inside an "async def")'
|
||||
)
|
||||
|
||||
return self.start()
|
||||
|
||||
async def __aenter__(self):
|
||||
|
Reference in New Issue
Block a user