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

Function _on_completion

Lib/asyncio/tasks.py:503–514  ·  view source on GitHub ↗
(f)

Source from the content-addressed store, hash-verified

501 cur_task = current_task()
502
503 def _on_completion(f):
504 nonlocal counter
505 counter -= 1
506 if (counter <= 0 or
507 return_when == FIRST_COMPLETED or
508 return_when == FIRST_EXCEPTION and (not f.cancelled() and
509 f.exception() is not None)):
510 if timeout_handle is not None:
511 timeout_handle.cancel()
512 if not waiter.done():
513 waiter.set_result(None)
514 futures.future_discard_from_awaited_by(f, cur_task)
515
516 for f in fs:
517 f.add_done_callback(_on_completion)

Callers

nothing calls this directly

Calls 5

cancelledMethod · 0.45
exceptionMethod · 0.45
cancelMethod · 0.45
doneMethod · 0.45
set_resultMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…