[issue31452] asyncio.gather does not cancel tasks if one fails

Yury Selivanov report at bugs.python.org
Fri Sep 22 00:36:42 EDT 2017


Yury Selivanov added the comment:

> I'm afraid I no longer have all the details of this design in my head, and I have no idea what the fix does (and no time to read up on everything).

Let's say we have three tasks: t1, t2, t3.  Then we use gather on them:

   await gather(t1, t2, t3)

Let's say that t2 finishes first with an exception.

Currently, both t1 and t3 would continue their execution even though gather throws the t2 exception.

The PR for this issue makes 'gather' to cancel both t1 and t3 as soon as t2 throws an exception.

The question is: I see the point of the PR, but I'm afraid that it's too late to change the semantics of asyncio.gather.  Instead we should consider adding new TaskGroup API (we discussed it briefly on the sprint).

----------

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue31452>
_______________________________________


More information about the Python-bugs-list mailing list