Closed brennane closed 7 years ago
Intriguing. Looking into it.
I've pushed a change for this. gather()
will now cancel all tasks if it gets any kind of cancellation. The resulting cancellation exception has the results of all tasks attached to it. For example::
try:
results = await gather(tasks)
except CancelledError as e:
resullts = e.results # Partially completed results (before cancellation)
Open to suggestions on further improvement
Howdy,
This is a question about the interplay between
curio.timeout_at
and (for example)curio.gather
. The default mechanism is likely to give someone a confusing ride.If you run the first example
tm0.py
the third "curio.gather" task swallows the timeout that should be used to control things. See the reference gist below and its functiontimeout_gather
.In the second example
tm1.py
the exception is broadcast to the inner tasks. It seems this would be the intended behavior.Here's my ugly gist code.
tm0.py gist showing unexpected behavior tm1.py gist showing expected behavior tb.py traceback printer