mirror of
https://github.com/python/cpython.git
synced 2025-07-23 03:05:38 +00:00
Issue #26923: Fix asyncio.Gather to refuse being cancelled once all children are done.
Patch by Johannes Ebke.
This commit is contained in:
parent
f8c1505736
commit
3d67615a48
3 changed files with 38 additions and 2 deletions
|
@ -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):
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue