Message403294
I've spotted a little bug in how asyncio.CancelledError() exception is propagated inside an asyncio.Task.
Since python 3.9 the asyncio.Task.cancel() method has a new 'msg' parameter, that will create an asyncio.CancelledError(msg) exception incorporating that message.
The exception is successfully propagated to the coroutine the asyncio.Task is running, so the coroutine successfully gets raised an asyncio.CancelledError(msg) with the specified message in asyncio.Task.cancel(msg) method.
But, once the asyncio.Task is cancelled, is impossible to retrieve that original asyncio.CancelledError(msg) exception with the message, because it seems that *a new* asyncio.CancelledError() [without the message] is raised when asyncio.Task.result() or asyncio.Task.exception() methods are called.
I have the feeling that this is just wrong, and that the original message specified in asyncio.Task.cancel(msg) should be propagated even also asyncio.Task.result() is called.
I'm including a little snippet of code that clearly shows this bug.
I'm using python 3.9.6, in particular:
Python 3.9.6 (default, Aug 21 2021, 09:02:49)
[GCC 10.2.1 20210110] on linux |
|
Date |
User |
Action |
Args |
2021-10-06 11:30:42 | pagliaricci.m | set | recipients:
+ pagliaricci.m, asvetlov, yselivanov |
2021-10-06 11:30:42 | pagliaricci.m | set | messageid: <1633519842.27.0.396754460358.issue45390@roundup.psfhosted.org> |
2021-10-06 11:30:42 | pagliaricci.m | link | issue45390 messages |
2021-10-06 11:30:42 | pagliaricci.m | create | |
|