summaryrefslogtreecommitdiffstats
path: root/Lib/asyncio
diff options
context:
space:
mode:
authorYury Selivanov <yury@magic.io>2016-10-21 21:22:17 (GMT)
committerYury Selivanov <yury@magic.io>2016-10-21 21:22:17 (GMT)
commit3d67615a485f4769eec5927e17989b31d6917e1c (patch)
tree9e93ca98520dd3c407c6e87bff613707e5b46d78 /Lib/asyncio
parentf8c1505736cb6eeb264e58c28d1f94d8fe7cad34 (diff)
downloadcpython-3d67615a485f4769eec5927e17989b31d6917e1c.zip
cpython-3d67615a485f4769eec5927e17989b31d6917e1c.tar.gz
cpython-3d67615a485f4769eec5927e17989b31d6917e1c.tar.bz2
Issue #26923: Fix asyncio.Gather to refuse being cancelled once all children are done.
Patch by Johannes Ebke.
Diffstat (limited to 'Lib/asyncio')
-rw-r--r--Lib/asyncio/tasks.py6
1 files changed, 4 insertions, 2 deletions
diff --git a/Lib/asyncio/tasks.py b/Lib/asyncio/tasks.py
index 14949d1..8852aa5 100644
--- a/Lib/asyncio/tasks.py
+++ b/Lib/asyncio/tasks.py
@@ -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):