1REVERT https://github.com/python/cpython/commit/300d812fd1c4d9244e71de0d228cc72439d312a7
2--- b/Doc/library/asyncio-eventloop.rst
3+++ a/Doc/library/asyncio-eventloop.rst
4@@ -43,12 +43,10 @@
5
6 Get the current event loop.
7
8+ If there is no current event loop set in the current OS thread,
9+ the OS thread is main, and :func:`set_event_loop` has not yet
10+ been called, asyncio will create a new event loop and set it as the
11+ current one.
12- When called from a coroutine or a callback (e.g. scheduled with
13- call_soon or similar API), this function will always return the
14- running event loop.
15-
16- If there is no running event loop set, the function will return
17- the result of ``get_event_loop_policy().get_event_loop()`` call.
18
19 Because this function has rather complex behavior (especially
20 when custom event loop policies are in use), using the
21@@ -60,14 +58,10 @@
22 event loop.
23
24 .. deprecated:: 3.10
25+ Emits a deprecation warning if there is no running event loop.
26+ In future Python releases, this function may become an alias of
27+ :func:`get_running_loop` and will accordingly raise a
28+ :exc:`RuntimeError` if there is no running event loop.
29- Deprecation warning is emitted if there is no current event loop.
30- In Python 3.12 it will be an error.
31-
32- .. note::
33- In Python versions 3.10.0--3.10.8 this function
34- (and other functions which used it implicitly) emitted a
35- :exc:`DeprecationWarning` if there was no running event loop, even if
36- the current loop was set.
37
38 .. function:: set_event_loop(loop)
39
40reverted:
41--- b/Doc/library/asyncio-llapi-index.rst
42+++ a/Doc/library/asyncio-llapi-index.rst
43@@ -19,7 +19,7 @@
44 - The **preferred** function to get the running event loop.
45
46 * - :func:`asyncio.get_event_loop`
47+ - Get an event loop instance (current or via the policy).
48- - Get an event loop instance (running or current via the current policy).
49
50 * - :func:`asyncio.set_event_loop`
51 - Set the event loop as current via the current policy.
52reverted:
53--- b/Doc/library/asyncio-policy.rst
54+++ a/Doc/library/asyncio-policy.rst
55@@ -112,11 +112,6 @@
56
57 On Windows, :class:`ProactorEventLoop` is now used by default.
58
59- .. deprecated:: 3.10.9
60- :meth:`get_event_loop` now emits a :exc:`DeprecationWarning` if there
61- is no current event loop set and a new event loop has been implicitly
62- created. In Python 3.12 it will be an error.
63-
64
65 .. class:: WindowsSelectorEventLoopPolicy
66
67reverted:
68--- b/Lib/asyncio/events.py
69+++ a/Lib/asyncio/events.py
70@@ -650,21 +650,6 @@
71 if (self._local._loop is None and
72 not self._local._set_called and
73 threading.current_thread() is threading.main_thread()):
74- stacklevel = 2
75- try:
76- f = sys._getframe(1)
77- except AttributeError:
78- pass
79- else:
80- while f:
81- module = f.f_globals.get('__name__')
82- if not (module == 'asyncio' or module.startswith('asyncio.')):
83- break
84- f = f.f_back
85- stacklevel += 1
86- import warnings
87- warnings.warn('There is no current event loop',
88- DeprecationWarning, stacklevel=stacklevel)
89 self.set_event_loop(self.new_event_loop())
90
91 if self._local._loop is None:
92@@ -778,13 +763,12 @@
93
94
95 def _get_event_loop(stacklevel=3):
96- # This internal method is going away in Python 3.12, left here only for
97- # backwards compatibility with 3.10.0 - 3.10.8 and 3.11.0.
98- # Similarly, this method's C equivalent in _asyncio is going away as well.
99- # See GH-99949 for more details.
100 current_loop = _get_running_loop()
101 if current_loop is not None:
102 return current_loop
103+ import warnings
104+ warnings.warn('There is no current event loop',
105+ DeprecationWarning, stacklevel=stacklevel)
106 return get_event_loop_policy().get_event_loop()
107
108
109reverted:
110--- b/Lib/test/test_asyncio/test_base_events.py
111+++ a/Lib/test/test_asyncio/test_base_events.py
112@@ -752,7 +752,7 @@
113 def test_env_var_debug(self):
114 code = '\n'.join((
115 'import asyncio',
116+ 'loop = asyncio.get_event_loop()',
117- 'loop = asyncio.new_event_loop()',
118 'print(loop.get_debug())'))
119
120 # Test with -E to not fail if the unit test was run with
121reverted:
122--- b/Lib/test/test_asyncio/test_events.py
123+++ a/Lib/test/test_asyncio/test_events.py
124@@ -2561,9 +2561,8 @@
125 def test_get_event_loop(self):
126 policy = asyncio.DefaultEventLoopPolicy()
127 self.assertIsNone(policy._local._loop)
128+
129+ loop = policy.get_event_loop()
130- with self.assertWarns(DeprecationWarning) as cm:
131- loop = policy.get_event_loop()
132- self.assertEqual(cm.filename, __file__)
133 self.assertIsInstance(loop, asyncio.AbstractEventLoop)
134
135 self.assertIs(policy._local._loop, loop)
136@@ -2577,10 +2576,7 @@
137 policy, "set_event_loop",
138 wraps=policy.set_event_loop) as m_set_event_loop:
139
140+ loop = policy.get_event_loop()
141- with self.assertWarns(DeprecationWarning) as cm:
142- loop = policy.get_event_loop()
143- self.addCleanup(loop.close)
144- self.assertEqual(cm.filename, __file__)
145
146 # policy._local._loop must be set through .set_event_loop()
147 # (the unix DefaultEventLoopPolicy needs this call to attach
148@@ -2614,8 +2610,7 @@
149
150 def test_set_event_loop(self):
151 policy = asyncio.DefaultEventLoopPolicy()
152+ old_loop = policy.get_event_loop()
153- old_loop = policy.new_event_loop()
154- policy.set_event_loop(old_loop)
155
156 self.assertRaises(AssertionError, policy.set_event_loop, object())
157
158@@ -2728,11 +2723,15 @@
159 asyncio.set_event_loop_policy(Policy())
160 loop = asyncio.new_event_loop()
161
162+ with self.assertWarns(DeprecationWarning) as cm:
163+ with self.assertRaises(TestError):
164+ asyncio.get_event_loop()
165+ self.assertEqual(cm.warnings[0].filename, __file__)
166- with self.assertRaises(TestError):
167- asyncio.get_event_loop()
168 asyncio.set_event_loop(None)
169+ with self.assertWarns(DeprecationWarning) as cm:
170+ with self.assertRaises(TestError):
171+ asyncio.get_event_loop()
172+ self.assertEqual(cm.warnings[0].filename, __file__)
173- with self.assertRaises(TestError):
174- asyncio.get_event_loop()
175
176 with self.assertRaisesRegex(RuntimeError, 'no running'):
177 asyncio.get_running_loop()
178@@ -2746,11 +2745,16 @@
179 loop.run_until_complete(func())
180
181 asyncio.set_event_loop(loop)
182+ with self.assertWarns(DeprecationWarning) as cm:
183+ with self.assertRaises(TestError):
184+ asyncio.get_event_loop()
185+ self.assertEqual(cm.warnings[0].filename, __file__)
186+
187- with self.assertRaises(TestError):
188- asyncio.get_event_loop()
189 asyncio.set_event_loop(None)
190+ with self.assertWarns(DeprecationWarning) as cm:
191+ with self.assertRaises(TestError):
192+ asyncio.get_event_loop()
193+ self.assertEqual(cm.warnings[0].filename, __file__)
194- with self.assertRaises(TestError):
195- asyncio.get_event_loop()
196
197 finally:
198 asyncio.set_event_loop_policy(old_policy)
199@@ -2774,8 +2778,10 @@
200 self.addCleanup(loop2.close)
201 self.assertEqual(cm.warnings[0].filename, __file__)
202 asyncio.set_event_loop(None)
203+ with self.assertWarns(DeprecationWarning) as cm:
204+ with self.assertRaisesRegex(RuntimeError, 'no current'):
205+ asyncio.get_event_loop()
206+ self.assertEqual(cm.warnings[0].filename, __file__)
207- with self.assertRaisesRegex(RuntimeError, 'no current'):
208- asyncio.get_event_loop()
209
210 with self.assertRaisesRegex(RuntimeError, 'no running'):
211 asyncio.get_running_loop()
212@@ -2789,11 +2795,15 @@
213 loop.run_until_complete(func())
214
215 asyncio.set_event_loop(loop)
216+ with self.assertWarns(DeprecationWarning) as cm:
217+ self.assertIs(asyncio.get_event_loop(), loop)
218+ self.assertEqual(cm.warnings[0].filename, __file__)
219- self.assertIs(asyncio.get_event_loop(), loop)
220
221 asyncio.set_event_loop(None)
222+ with self.assertWarns(DeprecationWarning) as cm:
223+ with self.assertRaisesRegex(RuntimeError, 'no current'):
224+ asyncio.get_event_loop()
225+ self.assertEqual(cm.warnings[0].filename, __file__)
226- with self.assertRaisesRegex(RuntimeError, 'no current'):
227- asyncio.get_event_loop()
228
229 finally:
230 asyncio.set_event_loop_policy(old_policy)
231reverted:
232--- b/Lib/test/test_asyncio/test_futures.py
233+++ a/Lib/test/test_asyncio/test_futures.py
234@@ -145,8 +145,10 @@
235 self.assertTrue(f.cancelled())
236
237 def test_constructor_without_loop(self):
238+ with self.assertWarns(DeprecationWarning) as cm:
239+ with self.assertRaisesRegex(RuntimeError, 'There is no current event loop'):
240+ self._new_future()
241+ self.assertEqual(cm.warnings[0].filename, __file__)
242- with self.assertRaisesRegex(RuntimeError, 'no current event loop'):
243- self._new_future()
244
245 def test_constructor_use_running_loop(self):
246 async def test():
247@@ -156,10 +158,12 @@
248 self.assertIs(f.get_loop(), self.loop)
249
250 def test_constructor_use_global_loop(self):
251+ # Deprecated in 3.10
252- # Deprecated in 3.10, undeprecated in 3.11.1
253 asyncio.set_event_loop(self.loop)
254 self.addCleanup(asyncio.set_event_loop, None)
255+ with self.assertWarns(DeprecationWarning) as cm:
256+ f = self._new_future()
257+ self.assertEqual(cm.warnings[0].filename, __file__)
258- f = self._new_future()
259 self.assertIs(f._loop, self.loop)
260 self.assertIs(f.get_loop(), self.loop)
261
262@@ -495,8 +499,10 @@
263 return (arg, threading.get_ident())
264 ex = concurrent.futures.ThreadPoolExecutor(1)
265 f1 = ex.submit(run, 'oi')
266+ with self.assertWarns(DeprecationWarning) as cm:
267+ with self.assertRaises(RuntimeError):
268+ asyncio.wrap_future(f1)
269+ self.assertEqual(cm.warnings[0].filename, __file__)
270- with self.assertRaisesRegex(RuntimeError, 'no current event loop'):
271- asyncio.wrap_future(f1)
272 ex.shutdown(wait=True)
273
274 def test_wrap_future_use_running_loop(self):
275@@ -511,14 +517,16 @@
276 ex.shutdown(wait=True)
277
278 def test_wrap_future_use_global_loop(self):
279+ # Deprecated in 3.10
280- # Deprecated in 3.10, undeprecated in 3.11.1
281 asyncio.set_event_loop(self.loop)
282 self.addCleanup(asyncio.set_event_loop, None)
283 def run(arg):
284 return (arg, threading.get_ident())
285 ex = concurrent.futures.ThreadPoolExecutor(1)
286 f1 = ex.submit(run, 'oi')
287+ with self.assertWarns(DeprecationWarning) as cm:
288+ f2 = asyncio.wrap_future(f1)
289+ self.assertEqual(cm.warnings[0].filename, __file__)
290- f2 = asyncio.wrap_future(f1)
291 self.assertIs(self.loop, f2._loop)
292 ex.shutdown(wait=True)
293
294reverted:
295--- b/Lib/test/test_asyncio/test_streams.py
296+++ a/Lib/test/test_asyncio/test_streams.py
297@@ -747,8 +747,10 @@
298 self.assertEqual(data, b'data')
299
300 def test_streamreader_constructor_without_loop(self):
301+ with self.assertWarns(DeprecationWarning) as cm:
302+ with self.assertRaisesRegex(RuntimeError, 'There is no current event loop'):
303+ asyncio.StreamReader()
304+ self.assertEqual(cm.warnings[0].filename, __file__)
305- with self.assertRaisesRegex(RuntimeError, 'no current event loop'):
306- asyncio.StreamReader()
307
308 def test_streamreader_constructor_use_running_loop(self):
309 # asyncio issue #184: Ensure that StreamReaderProtocol constructor
310@@ -762,17 +764,21 @@
311 def test_streamreader_constructor_use_global_loop(self):
312 # asyncio issue #184: Ensure that StreamReaderProtocol constructor
313 # retrieves the current loop if the loop parameter is not set
314+ # Deprecated in 3.10
315- # Deprecated in 3.10, undeprecated in 3.11.1
316 self.addCleanup(asyncio.set_event_loop, None)
317 asyncio.set_event_loop(self.loop)
318+ with self.assertWarns(DeprecationWarning) as cm:
319+ reader = asyncio.StreamReader()
320+ self.assertEqual(cm.warnings[0].filename, __file__)
321- reader = asyncio.StreamReader()
322 self.assertIs(reader._loop, self.loop)
323
324
325 def test_streamreaderprotocol_constructor_without_loop(self):
326 reader = mock.Mock()
327+ with self.assertWarns(DeprecationWarning) as cm:
328+ with self.assertRaisesRegex(RuntimeError, 'There is no current event loop'):
329+ asyncio.StreamReaderProtocol(reader)
330+ self.assertEqual(cm.warnings[0].filename, __file__)
331- with self.assertRaisesRegex(RuntimeError, 'no current event loop'):
332- asyncio.StreamReaderProtocol(reader)
333
334 def test_streamreaderprotocol_constructor_use_running_loop(self):
335 # asyncio issue #184: Ensure that StreamReaderProtocol constructor
336@@ -786,11 +792,13 @@
337 def test_streamreaderprotocol_constructor_use_global_loop(self):
338 # asyncio issue #184: Ensure that StreamReaderProtocol constructor
339 # retrieves the current loop if the loop parameter is not set
340+ # Deprecated in 3.10
341- # Deprecated in 3.10, undeprecated in 3.11.1
342 self.addCleanup(asyncio.set_event_loop, None)
343 asyncio.set_event_loop(self.loop)
344 reader = mock.Mock()
345+ with self.assertWarns(DeprecationWarning) as cm:
346+ protocol = asyncio.StreamReaderProtocol(reader)
347+ self.assertEqual(cm.warnings[0].filename, __file__)
348- protocol = asyncio.StreamReaderProtocol(reader)
349 self.assertIs(protocol._loop, self.loop)
350
351 def test_multiple_drain(self):
352reverted:
353--- b/Lib/test/test_asyncio/test_tasks.py
354+++ a/Lib/test/test_asyncio/test_tasks.py
355@@ -210,8 +210,10 @@
356
357 a = notmuch()
358 self.addCleanup(a.close)
359+ with self.assertWarns(DeprecationWarning) as cm:
360+ with self.assertRaisesRegex(RuntimeError, 'There is no current event loop'):
361+ asyncio.ensure_future(a)
362+ self.assertEqual(cm.warnings[0].filename, __file__)
363- with self.assertRaisesRegex(RuntimeError, 'no current event loop'):
364- asyncio.ensure_future(a)
365
366 async def test():
367 return asyncio.ensure_future(notmuch())
368@@ -221,10 +223,12 @@
369 self.assertTrue(t.done())
370 self.assertEqual(t.result(), 'ok')
371
372+ # Deprecated in 3.10
373- # Deprecated in 3.10.0, undeprecated in 3.10.9
374 asyncio.set_event_loop(self.loop)
375 self.addCleanup(asyncio.set_event_loop, None)
376+ with self.assertWarns(DeprecationWarning) as cm:
377+ t = asyncio.ensure_future(notmuch())
378+ self.assertEqual(cm.warnings[0].filename, __file__)
379- t = asyncio.ensure_future(notmuch())
380 self.assertIs(t._loop, self.loop)
381 self.loop.run_until_complete(t)
382 self.assertTrue(t.done())
383@@ -243,8 +247,10 @@
384
385 a = notmuch()
386 self.addCleanup(a.close)
387+ with self.assertWarns(DeprecationWarning) as cm:
388+ with self.assertRaisesRegex(RuntimeError, 'There is no current event loop'):
389+ asyncio.ensure_future(a)
390+ self.assertEqual(cm.warnings[0].filename, __file__)
391- with self.assertRaisesRegex(RuntimeError, 'There is no current event loop'):
392- asyncio.ensure_future(a)
393
394 async def test():
395 return asyncio.ensure_future(notmuch())
396@@ -254,10 +260,12 @@
397 self.assertTrue(t.done())
398 self.assertEqual(t.result(), 'ok')
399
400+ # Deprecated in 3.10
401- # Deprecated in 3.10.0, undeprecated in 3.10.9
402 asyncio.set_event_loop(self.loop)
403 self.addCleanup(asyncio.set_event_loop, None)
404+ with self.assertWarns(DeprecationWarning) as cm:
405+ t = asyncio.ensure_future(notmuch())
406+ self.assertEqual(cm.warnings[0].filename, __file__)
407- t = asyncio.ensure_future(notmuch())
408 self.assertIs(t._loop, self.loop)
409 self.loop.run_until_complete(t)
410 self.assertTrue(t.done())
411@@ -1480,8 +1488,10 @@
412 self.addCleanup(a.close)
413
414 futs = asyncio.as_completed([a])
415+ with self.assertWarns(DeprecationWarning) as cm:
416+ with self.assertRaisesRegex(RuntimeError, 'There is no current event loop'):
417+ list(futs)
418+ self.assertEqual(cm.warnings[0].filename, __file__)
419- with self.assertRaisesRegex(RuntimeError, 'no current event loop'):
420- list(futs)
421
422 def test_as_completed_coroutine_use_running_loop(self):
423 loop = self.new_test_loop()
424@@ -1497,14 +1507,17 @@
425 loop.run_until_complete(test())
426
427 def test_as_completed_coroutine_use_global_loop(self):
428+ # Deprecated in 3.10
429- # Deprecated in 3.10.0, undeprecated in 3.10.9
430 async def coro():
431 return 42
432
433 loop = self.new_test_loop()
434 asyncio.set_event_loop(loop)
435 self.addCleanup(asyncio.set_event_loop, None)
436+ futs = asyncio.as_completed([coro()])
437+ with self.assertWarns(DeprecationWarning) as cm:
438+ futs = list(futs)
439+ self.assertEqual(cm.warnings[0].filename, __file__)
440- futs = list(asyncio.as_completed([coro()]))
441 self.assertEqual(len(futs), 1)
442 self.assertEqual(loop.run_until_complete(futs[0]), 42)
443
444@@ -1974,8 +1987,10 @@
445
446 inner = coro()
447 self.addCleanup(inner.close)
448+ with self.assertWarns(DeprecationWarning) as cm:
449+ with self.assertRaisesRegex(RuntimeError, 'There is no current event loop'):
450+ asyncio.shield(inner)
451+ self.assertEqual(cm.warnings[0].filename, __file__)
452- with self.assertRaisesRegex(RuntimeError, 'no current event loop'):
453- asyncio.shield(inner)
454
455 def test_shield_coroutine_use_running_loop(self):
456 async def coro():
457@@ -1989,13 +2004,15 @@
458 self.assertEqual(res, 42)
459
460 def test_shield_coroutine_use_global_loop(self):
461+ # Deprecated in 3.10
462- # Deprecated in 3.10.0, undeprecated in 3.10.9
463 async def coro():
464 return 42
465
466 asyncio.set_event_loop(self.loop)
467 self.addCleanup(asyncio.set_event_loop, None)
468+ with self.assertWarns(DeprecationWarning) as cm:
469+ outer = asyncio.shield(coro())
470+ self.assertEqual(cm.warnings[0].filename, __file__)
471- outer = asyncio.shield(coro())
472 self.assertEqual(outer._loop, self.loop)
473 res = self.loop.run_until_complete(outer)
474 self.assertEqual(res, 42)
475@@ -2933,7 +2950,7 @@
476 self.assertIsNone(asyncio.current_task(loop=self.loop))
477
478 def test_current_task_no_running_loop_implicit(self):
479+ with self.assertRaises(RuntimeError):
480- with self.assertRaisesRegex(RuntimeError, 'no running event loop'):
481 asyncio.current_task()
482
483 def test_current_task_with_implicit_loop(self):
484@@ -3097,8 +3114,10 @@
485 return asyncio.gather(*args, **kwargs)
486
487 def test_constructor_empty_sequence_without_loop(self):
488+ with self.assertWarns(DeprecationWarning) as cm:
489+ with self.assertRaises(RuntimeError):
490+ asyncio.gather()
491+ self.assertEqual(cm.warnings[0].filename, __file__)
492- with self.assertRaisesRegex(RuntimeError, 'no current event loop'):
493- asyncio.gather()
494
495 def test_constructor_empty_sequence_use_running_loop(self):
496 async def gather():
497@@ -3111,10 +3130,12 @@
498 self.assertEqual(fut.result(), [])
499
500 def test_constructor_empty_sequence_use_global_loop(self):
501+ # Deprecated in 3.10
502- # Deprecated in 3.10.0, undeprecated in 3.10.9
503 asyncio.set_event_loop(self.one_loop)
504 self.addCleanup(asyncio.set_event_loop, None)
505+ with self.assertWarns(DeprecationWarning) as cm:
506+ fut = asyncio.gather()
507+ self.assertEqual(cm.warnings[0].filename, __file__)
508- fut = asyncio.gather()
509 self.assertIsInstance(fut, asyncio.Future)
510 self.assertIs(fut._loop, self.one_loop)
511 self._run_loop(self.one_loop)
512@@ -3202,8 +3223,10 @@
513 self.addCleanup(gen1.close)
514 gen2 = coro()
515 self.addCleanup(gen2.close)
516+ with self.assertWarns(DeprecationWarning) as cm:
517+ with self.assertRaises(RuntimeError):
518+ asyncio.gather(gen1, gen2)
519+ self.assertEqual(cm.warnings[0].filename, __file__)
520- with self.assertRaisesRegex(RuntimeError, 'no current event loop'):
521- asyncio.gather(gen1, gen2)
522
523 def test_constructor_use_running_loop(self):
524 async def coro():
525@@ -3217,14 +3240,16 @@
526 self.one_loop.run_until_complete(fut)
527
528 def test_constructor_use_global_loop(self):
529+ # Deprecated in 3.10
530- # Deprecated in 3.10.0, undeprecated in 3.10.9
531 async def coro():
532 return 'abc'
533 asyncio.set_event_loop(self.other_loop)
534 self.addCleanup(asyncio.set_event_loop, None)
535 gen1 = coro()
536 gen2 = coro()
537+ with self.assertWarns(DeprecationWarning) as cm:
538+ fut = asyncio.gather(gen1, gen2)
539+ self.assertEqual(cm.warnings[0].filename, __file__)
540- fut = asyncio.gather(gen1, gen2)
541 self.assertIs(fut._loop, self.other_loop)
542 self.other_loop.run_until_complete(fut)
543
544reverted:
545--- b/Lib/test/test_asyncio/test_unix_events.py
546+++ a/Lib/test/test_asyncio/test_unix_events.py
547@@ -1740,8 +1740,7 @@
548
549 def test_child_watcher_replace_mainloop_existing(self):
550 policy = self.create_policy()
551+ loop = policy.get_event_loop()
552- loop = policy.new_event_loop()
553- policy.set_event_loop(loop)
554
555 # Explicitly setup SafeChildWatcher,
556 # default ThreadedChildWatcher has no _loop property
557reverted:
558--- b/Lib/test/test_coroutines.py
559+++ a/Lib/test/test_coroutines.py
560@@ -2319,8 +2319,7 @@
561 def test_unawaited_warning_during_shutdown(self):
562 code = ("import asyncio\n"
563 "async def f(): pass\n"
564+ "asyncio.gather(f())\n")
565- "async def t(): asyncio.gather(f())\n"
566- "asyncio.run(t())\n")
567 assert_python_ok("-c", code)
568
569 code = ("import sys\n"
570reverted:
571--- b/Modules/_asynciomodule.c
572+++ a/Modules/_asynciomodule.c
573@@ -332,6 +332,13 @@
574 return loop;
575 }
576
577+ if (PyErr_WarnEx(PyExc_DeprecationWarning,
578+ "There is no current event loop",
579+ stacklevel))
580+ {
581+ return NULL;
582+ }
583+
584 policy = PyObject_CallNoArgs(asyncio_get_event_loop_policy);
585 if (policy == NULL) {
586 return NULL;
587@@ -3085,11 +3092,6 @@
588 return get_event_loop(1);
589 }
590
591-// This internal method is going away in Python 3.12, left here only for
592-// backwards compatibility with 3.10.0 - 3.10.8 and 3.11.0.
593-// Similarly, this method's Python equivalent in asyncio.events is going
594-// away as well.
595-// See GH-99949 for more details.
596 /*[clinic input]
597 _asyncio._get_event_loop
598 stacklevel: int = 3