erdewit/nest_asyncio

DeprecationWarning on Python 3.10

douglas-raillard-arm opened this issue · 0 comments

Running nest_asyncio.apply() on Python 3.10 gives the following warning:

lisa/monad.py:71: in <module>
    nest_asyncio.apply()
.lisa-venv-3.10/lib/python3.10/site-packages/nest_asyncio.py:12: in apply
    loop = loop or asyncio.get_event_loop()
DeprecationWarning: There is no current event loop

This is problematic for CI test setup that are treating warnings as errors and therefore fail.

According to [1], asyncio.get_event_loop() will soon become asyncio.get_running_loop() so I guess nest_asyncio should manually use asyncio.new_event_loop() and asyncio.set_event_loop() in case no loop is found.

[1] https://docs.python.org/3/library/asyncio-eventloop.html#asyncio.get_event_loop