-
-
Notifications
You must be signed in to change notification settings - Fork 102
Do not call asyncio.get_event_loop() if no existing event loop #353
Description
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.