aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBenjamin Mintz <[email protected]>2019-06-13 19:38:07 +0000
committerRapptz <[email protected]>2019-06-20 22:51:28 -0400
commit850a0431bfe869ca03ee22d7be5c4c7692166eab (patch)
tree3166147e7a0ff6ef7ce9b85635cb588b98a986a3
parent[commands] Ensure cooldowns are properly copied. (diff)
downloaddiscord.py-850a0431bfe869ca03ee22d7be5c4c7692166eab.tar.xz
discord.py-850a0431bfe869ca03ee22d7be5c4c7692166eab.zip
Catch asyncio.CancelledError in 3.8 in typing context manager
In python 3.8, asyncio.CancelledError is a subclass of BaseException rather than Exception, so `except Exception:` will not swallow CancelledError. This change prevents an error in 3.8 from being printed to the console when the following is run: ``` async with ctx.typing(): pass ```
-rw-r--r--discord/context_managers.py2
1 files changed, 1 insertions, 1 deletions
diff --git a/discord/context_managers.py b/discord/context_managers.py
index 38751831..e7ac501c 100644
--- a/discord/context_managers.py
+++ b/discord/context_managers.py
@@ -30,7 +30,7 @@ def _typing_done_callback(fut):
# just retrieve any exception and call it a day
try:
fut.exception()
- except Exception:
+ except (asyncio.CancelledError, Exception):
pass
class Typing: