Issue #26923: Fix asyncio.Gather to refuse being cancelled once all children are done.

Patch by Johannes Ebke.
This commit is contained in:
Yury Selivanov 2016-10-21 17:22:17 -04:00
parent f8c1505736
commit 3d67615a48
3 changed files with 38 additions and 2 deletions

View file

@ -592,9 +592,11 @@ class _GatheringFuture(futures.Future):
def cancel(self):
if self.done():
return False
ret = False
for child in self._children:
child.cancel()
return True
if child.cancel():
ret = True
return ret
def gather(*coros_or_futures, loop=None, return_exceptions=False):