Message403521
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) Now: if I re-raise the asyncio.CancelledError as-is, I lose the message,
if I call the `asyncio.Task.exception()` function.
3) If I raise a *new* asyncio.CancelledError with a new message, inside the
job() coroutine's `except asyncio.CancelledError:` block, I still lose the
message if I call `asyncio.Task.exception()`.
4) But if I raise another exception, say `raise ValueError("TEST")`, always
from the `except asyncio.CancelledError:` block of the job() coroutine, I
*get* the message!
I get `ValueError("TEST")` by calling `asyncio.Task.exception()`, while I
don't with the `asyncio.CancelledError()` one.
Is this really wanted? Sorry, but I still find this a lot confusing.
Shouldn't it be better to return from the `asyncio.Task.exception()` the
old one (containing the message) ?
Or, otherwise, create a new instance of the exception for *ALL* the
exception classes?
Thank you for your time,
My Best Regards,
M.
On Thu, Oct 7, 2021 at 10:25 AM Thomas Grainger <report@bugs.python.org>
wrote:
>
> Thomas Grainger <tagrain@gmail.com> added the comment:
>
> afaik this is intentional https://bugs.python.org/issue31033
>
> ----------
> nosy: +graingert
>
> _______________________________________
> Python tracker <report@bugs.python.org>
> <https://bugs.python.org/issue45390>
> _______________________________________
> |
|
Date |
User |
Action |
Args |
2021-10-09 07:38:23 | pagliaricci.m | set | recipients:
+ pagliaricci.m, asvetlov, chris.jerdonek, yselivanov, graingert, bjs |
2021-10-09 07:38:23 | pagliaricci.m | link | issue45390 messages |
2021-10-09 07:38:23 | pagliaricci.m | create | |
|