Python 3.9 asyncio: Task cancel() throws asyncio.exceptions.CancelledError instead of asyncio.CancelledError
Clint Olsen
clint.olsen at gmail.com
Fri Mar 31 22:40:50 EDT 2023
On Friday, March 31, 2023 at 5:51:33 PM UTC-7, Chris Angelico wrote:
> Can you confirm that it is indeed failing to catch the exception? Try this:
>
> except asyncio.CancelledError:
> print("Cancelled correctly")
>
> followed by the same type checking from above. Since the ID is the
> same, I would expect it to match!
Well, now this works, so it's difficult to say how that was happening. If I can reproduce it I'll update this conversation. Thanks for the help!
-Clint
More information about the Python-list
mailing list