MCPcopy Index your code
hub / github.com/python/cpython / _GatheringFuture

Class _GatheringFuture

Lib/asyncio/tasks.py:739–765  ·  view source on GitHub ↗

Helper for gather(). This overrides cancel() to cancel all the children and act more like Task.cancel(), which doesn't immediately mark itself as cancelled.

Source from the content-addressed store, hash-verified

737
738
739class _GatheringFuture(futures.Future):
740 """Helper for gather().
741
742 This overrides cancel() to cancel all the children and act more
743 like Task.cancel(), which doesn't immediately mark itself as
744 cancelled.
745 """
746
747 def __init__(self, children, *, loop):
748 assert loop is not None
749 super().__init__(loop=loop)
750 self._children = children
751 self._cancel_requested = False
752
753 def cancel(self, msg=None):
754 if self.done():
755 return False
756 ret = False
757 for child in self._children:
758 if child.cancel(msg=msg):
759 ret = True
760 if ret:
761 # If any child tasks were actually cancelled, we should
762 # propagate the cancellation request regardless of
763 # *return_exceptions* argument. See issue 32684.
764 self._cancel_requested = True
765 return ret
766
767
768def gather(*coros_or_futures, return_exceptions=False):

Callers 1

gatherFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…