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

Method close

Lib/asyncio/runners.py:65–80  ·  view source on GitHub ↗

Shutdown and close event loop.

(self)

Source from the content-addressed store, hash-verified

63 self.close()
64
65 def close(self):
66 """Shutdown and close event loop."""
67 if self._state is not _State.INITIALIZED:
68 return
69 try:
70 loop = self._loop
71 _cancel_all_tasks(loop)
72 loop.run_until_complete(loop.shutdown_asyncgens())
73 loop.run_until_complete(
74 loop.shutdown_default_executor(constants.THREAD_JOIN_TIMEOUT))
75 finally:
76 if self._set_event_loop:
77 events.set_event_loop(None)
78 loop.close()
79 self._loop = None
80 self._state = _State.CLOSED
81
82 def get_loop(self):
83 """Return embedded event loop."""

Callers 11

__exit__Method · 0.95
test_explicit_closeMethod · 0.95
test_double_closeMethod · 0.95
__main__.pyFile · 0.45
ensure_futureFunction · 0.45
create_taskMethod · 0.45
pipe_connection_lostMethod · 0.45
_feed_stdinMethod · 0.45
_read_streamMethod · 0.45

Calls 5

_cancel_all_tasksFunction · 0.85
run_until_completeMethod · 0.45
shutdown_asyncgensMethod · 0.45
set_event_loopMethod · 0.45

Tested by 3

test_explicit_closeMethod · 0.76
test_double_closeMethod · 0.76