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

Function _cancel_all_tasks

Lib/asyncio/runners.py:207–225  ·  view source on GitHub ↗
(loop)

Source from the content-addressed store, hash-verified

205
206
207def _cancel_all_tasks(loop):
208 to_cancel = tasks.all_tasks(loop)
209 if not to_cancel:
210 return
211
212 for task in to_cancel:
213 task.cancel()
214
215 loop.run_until_complete(tasks.gather(*to_cancel, return_exceptions=True))
216
217 for task in to_cancel:
218 if task.cancelled():
219 continue
220 if task.exception() is not None:
221 loop.call_exception_handler({
222 'message': 'unhandled exception during asyncio.run() shutdown',
223 'exception': task.exception(),
224 'task': task,
225 })

Callers 1

closeMethod · 0.85

Calls 6

cancelMethod · 0.45
run_until_completeMethod · 0.45
gatherMethod · 0.45
cancelledMethod · 0.45
exceptionMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…