Replace asyncio.get_event_loop() with asyncio.get_running_loop() in coroutines
Proprietaryasyncio.get_event_loop() raises a RuntimeError in Python 3.14 where no event loop is set, rather than creating one. In the body of an async def, where a loop is always running, the call is replaced with asyncio.get_running_loop(). Elsewhere it is marked for review, as is a call through a name imported with from asyncio import get_event_loop.
org. openrewrite. python. migrate. ReplaceAsyncioGetEventLoopmod run . --recipe= org. openrewrite. python. migrate. ReplaceAsyncioGetEventLoopInstall it once, then run it on every repository under the current directory. New to the Moderne CLI? Set it up.