mirror of
https://github.com/python/cpython.git
synced 2025-08-04 17:08:35 +00:00
gh-93453: No longer create an event loop in get_event_loop() (#98440)
asyncio.get_event_loop() now always return either running event loop or the result of get_event_loop_policy().get_event_loop() call. The latter should now raise an RuntimeError if no current event loop was set instead of creating and setting a new event loop. It affects also a number of asyncio functions and constructors which call get_event_loop() implicitly: ensure_future(), shield(), gather(), etc. DeprecationWarning is no longer emitted if there is no running event loop but the current event loop was set. Co-authored-by: Łukasz Langa <lukasz@langa.pl>
This commit is contained in:
parent
b72014c783
commit
fd38a2f0ec
18 changed files with 114 additions and 251 deletions
|
@ -116,6 +116,10 @@ asyncio ships with the following built-in policies:
|
|||
|
||||
On Windows, :class:`ProactorEventLoop` is now used by default.
|
||||
|
||||
.. versionchanged:: 3.12
|
||||
:meth:`get_event_loop` now raises a :exc:`RuntimeError` if there is no
|
||||
current event loop set.
|
||||
|
||||
|
||||
.. class:: WindowsSelectorEventLoopPolicy
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue