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

Function get_event_loop

Lib/asyncio/events.py:821–834  ·  view source on GitHub ↗

Return an asyncio event loop. When called from a coroutine or a callback (e.g. scheduled with call_soon or similar API), this function will always return the running event loop. If there is no running event loop set, the function will return the result of `get_event_loop_policy().g

()

Source from the content-addressed store, hash-verified

819 _set_event_loop_policy(policy)
820
821def get_event_loop():
822 """Return an asyncio event loop.
823
824 When called from a coroutine or a callback (e.g. scheduled with call_soon
825 or similar API), this function will always return the running event loop.
826
827 If there is no running event loop set, the function will return
828 the result of `get_event_loop_policy().get_event_loop()` call.
829 """
830 # NOTE: this function is implemented in C (see _asynciomodule.c)
831 current_loop = _get_running_loop()
832 if current_loop is not None:
833 return current_loop
834 return _get_event_loop_policy().get_event_loop()
835
836
837def set_event_loop(loop):

Callers

nothing calls this directly

Calls 3

_get_running_loopFunction · 0.85
_get_event_loop_policyFunction · 0.85
get_event_loopMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…