Skip to content

Do not call asyncio.get_event_loop() if no existing event loop #353

@pepoluan

Description

@pepoluan

As described in https://docs.python.org/3/library/asyncio-eventloop.html , directly calling asyncio.get_event_loop() raises DeprecationWarning if no event loop is already running. The behavior of get_event_loop() was changed in Python 3.10.

Up to Python 3.9, get_event_loop() will silently create an event loop with no warnings.

It seems that in Python 3.10 and 3.11, get_event_loop() will still create an event loop, but a DeprecationWarning is raised.

The get_event_loop() behavior will change completely in Python 3.12, no longer creating an event loop but will raise an Error instead.

We must parse the code and ensure that get_event_loop() expecting an implicit event loop creation are removed from the code.

Metadata

Metadata

Assignees

No one assigned

    Labels

    compatibilitytech-debtThings that needs to be tidied up to avoid being bitten in the future...

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions