[issue46340] DeprecationWarning emitted when running asyncio tests

Erlend E. Aasland report at bugs.python.org
Tue Jan 11 03:45:34 EST 2022


New submission from Erlend E. Aasland <erlend.aasland at innova.no>:

Providing some more background, based on the changes proposed by Kumar in GH-30486:

asyncio.get_event_loop() was marked as deprecated in Python 3.10. Quoting from the asyncio documentation , https://docs.python.org/3/library/asyncio-eventloop.html (as of 3.10):

    Because this function has rather complex behavior (especially when custom
    event loop policies are in use), using the get_running_loop() function is
    preferred to get_event_loop() in coroutines and callbacks.

    [...]

    Deprecated since version 3.10: Deprecation warning is emitted if there is
    no running event loop. In future Python releases, this function will be an
    alias of get_running_loop().


GH-30486 proposes to replace asyncio.get_event_loop() with asyncio.new_event_loop().

----------
nosy: +erlendaasland

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue46340>
_______________________________________


More information about the Python-bugs-list mailing list