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 ```
This commit is contained in:
parent
671a19a24a
commit
850a0431bf
@ -30,7 +30,7 @@ def _typing_done_callback(fut):
|
|||||||
# just retrieve any exception and call it a day
|
# just retrieve any exception and call it a day
|
||||||
try:
|
try:
|
||||||
fut.exception()
|
fut.exception()
|
||||||
except Exception:
|
except (asyncio.CancelledError, Exception):
|
||||||
pass
|
pass
|
||||||
|
|
||||||
class Typing:
|
class Typing:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user