mirror of
https://github.com/python/cpython.git
synced 2025-08-31 05:58:33 +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
|
@ -5,16 +5,22 @@
|
|||
# SPDX-FileCopyrightText: Copyright (c) 2015-2021 MagicStack Inc. http://magic.io
|
||||
|
||||
__all__ = (
|
||||
'_AbstractEventLoopPolicy',
|
||||
'AbstractEventLoop', 'AbstractServer',
|
||||
'Handle', 'TimerHandle',
|
||||
'_get_event_loop_policy',
|
||||
'get_event_loop_policy',
|
||||
'_set_event_loop_policy',
|
||||
'set_event_loop_policy',
|
||||
'get_event_loop', 'set_event_loop', 'new_event_loop',
|
||||
'_set_running_loop', 'get_running_loop',
|
||||
'_get_running_loop',
|
||||
"_AbstractEventLoopPolicy",
|
||||
"AbstractEventLoop",
|
||||
"AbstractServer",
|
||||
"Handle",
|
||||
"TimerHandle",
|
||||
"_get_event_loop_policy",
|
||||
"get_event_loop_policy",
|
||||
"_set_event_loop_policy",
|
||||
"set_event_loop_policy",
|
||||
"get_event_loop",
|
||||
"_set_event_loop",
|
||||
"set_event_loop",
|
||||
"new_event_loop",
|
||||
"_set_running_loop",
|
||||
"get_running_loop",
|
||||
"_get_running_loop",
|
||||
)
|
||||
|
||||
import contextvars
|
||||
|
@ -801,9 +807,13 @@ def get_event_loop():
|
|||
return _get_event_loop_policy().get_event_loop()
|
||||
|
||||
|
||||
def _set_event_loop(loop):
|
||||
_get_event_loop_policy().set_event_loop(loop)
|
||||
|
||||
def set_event_loop(loop):
|
||||
"""Equivalent to calling get_event_loop_policy().set_event_loop(loop)."""
|
||||
_get_event_loop_policy().set_event_loop(loop)
|
||||
warnings._deprecated('asyncio.set_event_loop', remove=(3,16))
|
||||
_set_event_loop(loop)
|
||||
|
||||
|
||||
def new_event_loop():
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue