From 46ee8e86c61585acc7e663cb3340d5382bcd8b7f Mon Sep 17 00:00:00 2001 From: Lonami Date: Fri, 13 Nov 2020 09:53:00 +0100 Subject: [PATCH] Fix conv.wait_event no longer raising Timeout Should properly fix #1618. --- telethon/tl/custom/conversation.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/telethon/tl/custom/conversation.py b/telethon/tl/custom/conversation.py index 570707e9..5a4a71cf 100644 --- a/telethon/tl/custom/conversation.py +++ b/telethon/tl/custom/conversation.py @@ -338,10 +338,10 @@ class Conversation(ChatGetter): self._custom[counter] = (event, future) try: return await self._get_result(future, start_time, timeout, self._custom, counter) - except asyncio.TimeoutError: + finally: # Need to remove it from the dict if it times out, else we may # try and fail to set the result later (#1618). - del self._custom[counter] + self._custom.pop(counter, None) async def _check_custom(self, built): for key, (ev, fut) in list(self._custom.items()):