summaryrefslogtreecommitdiffstats
path: root/Modules
diff options
context:
space:
mode:
authorŁukasz Langa <lukasz@langa.pl>2022-12-06 17:40:30 (GMT)
committerGitHub <noreply@github.com>2022-12-06 17:40:30 (GMT)
commit300d812fd1c4d9244e71de0d228cc72439d312a7 (patch)
treeaa1099bf0884e6f4ad885825e7b8132da133b1a7 /Modules
parentb7ae1d22857c141ea4b0cc1f107e128596d02a94 (diff)
downloadcpython-300d812fd1c4d9244e71de0d228cc72439d312a7.zip
cpython-300d812fd1c4d9244e71de0d228cc72439d312a7.tar.gz
cpython-300d812fd1c4d9244e71de0d228cc72439d312a7.tar.bz2
[3.10] gh-93453: Only emit deprecation warning in asyncio.get_event_loop when a new event loop is created (#100059)
It no longer emits a deprecation warning if the current event loop was set. (cherry picked from commit 3fae04b10e2655a20a3aadb5e0d63e87206d0c67) Co-authored-by: Serhiy Storchaka <storchaka@gmail.com> Co-authored-by: Łukasz Langa <lukasz@langa.pl>
Diffstat (limited to 'Modules')
-rw-r--r--Modules/_asynciomodule.c12
1 files changed, 5 insertions, 7 deletions
diff --git a/Modules/_asynciomodule.c b/Modules/_asynciomodule.c
index c627382..8d0ff69 100644
--- a/Modules/_asynciomodule.c
+++ b/Modules/_asynciomodule.c
@@ -332,13 +332,6 @@ get_event_loop(int stacklevel)
return loop;
}
- if (PyErr_WarnEx(PyExc_DeprecationWarning,
- "There is no current event loop",
- stacklevel))
- {
- return NULL;
- }
-
policy = PyObject_CallNoArgs(asyncio_get_event_loop_policy);
if (policy == NULL) {
return NULL;
@@ -3092,6 +3085,11 @@ _asyncio_get_event_loop_impl(PyObject *module)
return get_event_loop(1);
}
+// This internal method is going away in Python 3.12, left here only for
+// backwards compatibility with 3.10.0 - 3.10.8 and 3.11.0.
+// Similarly, this method's Python equivalent in asyncio.events is going
+// away as well.
+// See GH-99949 for more details.
/*[clinic input]
_asyncio._get_event_loop
stacklevel: int = 3