Skip to content

asyncio docs: Replace deprecated use of get_event_loop() with new_event_loop() #96706

Closed
@zhanpon

Description

@zhanpon

In the asyncio's Event Loop document, some code examples will issue a DeprecationWarning when get_event_loop() is called:

$ python3 /tmp/hello.py
/tmp/hello.py:8: DeprecationWarning: There is no current event loop
  loop = asyncio.get_event_loop()

The reason is explained in the manual of asyncio.get_event_loop:

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().

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    Status

    Done

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions