Closed skumargupta-1 closed 11 months ago
The curio TaskGroup
implementation predates the one in asyncio
so any similarities between the two are purely coincidental (and I can't honesty remember if Curio ever made a special exception for cancellation here). If you want to handle this case in Curio, a task that could be potentially cancelled should probably be written with an explicit try/except to catch it and return.
I think this is a bug, but please let me know if this is intended behavior and I will close the issue.
Consider this sample program:
This program exits out when
multiply2
is cancelled.I would have expected the program to continue ad infinitum printing multiples of 3.
asyncio documentation says:
However, curio makes no such exception for
curio.TaskCancelledError
and always exits out:https://github.com/dabeaz/curio/blob/5d8ecb2333761b4fd629e14d940f3807d143c0ed/curio/task.py#L548