Marco Pagliaricci added the comment:
Andrew,
many thanks for your time, solving this issue.
I think your solution is the best to fix this little problem and I agree
with you on backporting.
My Best Regards,
and thanks again.
Marco
On Thu, Feb 17, 2022 at 10:29 AM Andrew Svetlov
wrote
New submission from Marco Pagliaricci :
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
Marco Pagliaricci added the comment:
OK, I see your point.
But I still can't understand one thing and I think it's very confusing:
1) if you see my example, inside the job() coroutine, I get correctly
cancelled with an `asyncio.CancelledError` exception containing my message.
2) No
Marco Pagliaricci added the comment:
Chris,
I'm attaching to this e-mail the code I'm referring to.
As you can see, in line 10, I re-raise the asyncio.CancelledError exception
with a message "TEST".
That message is lost, due to the reasons we've talked about.
My point
Marco Pagliaricci added the comment:
Chris,
ok, I have modified the snippet of code to better show what I mean.
Still here, the message of the CancelledError exception is lost, but if I
comment line 10, and uncomment line 11, so I throw a ValueError("TEST"),
that "TEST" st