mirror of
https://github.com/python/cpython.git
synced 2025-08-31 14:07:50 +00:00
gh-127949: deprecate asyncio.set_event_loop
(#128218)
Deprecate `asyncio.set_event_loop` to be removed in Python 3.16.
This commit is contained in:
parent
3ddd70ceaa
commit
9fce906825
16 changed files with 77 additions and 55 deletions
|
@ -74,7 +74,7 @@ class Runner:
|
|||
loop.shutdown_default_executor(constants.THREAD_JOIN_TIMEOUT))
|
||||
finally:
|
||||
if self._set_event_loop:
|
||||
events.set_event_loop(None)
|
||||
events._set_event_loop(None)
|
||||
loop.close()
|
||||
self._loop = None
|
||||
self._state = _State.CLOSED
|
||||
|
@ -147,7 +147,7 @@ class Runner:
|
|||
if not self._set_event_loop:
|
||||
# Call set_event_loop only once to avoid calling
|
||||
# attach_loop multiple times on child watchers
|
||||
events.set_event_loop(self._loop)
|
||||
events._set_event_loop(self._loop)
|
||||
self._set_event_loop = True
|
||||
else:
|
||||
self._loop = self._loop_factory()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue