Skip to content

Conversation

JeffersGlass
Copy link

With get_event_loop() no longer implicitly starting a new loop as of Python 3.14, any dev tool commands which start a serve will fail with a RuntimeError. If this occurs, start a new event loop before running the aiohttp app.

Fixes #45

@TomJGooding
Copy link

TomJGooding commented Oct 1, 2025

EDIT: Sorry, probably just ignore the below! After looking into aiohttp.web.run_app(), I see this also uses asyncio.new_event_loop() if none was passed, so I've probably just misunderstood.


Is asyncio.new_event_loop() definitely the correct replacement here?

I confess I'm no expert on asyncio, but reading up on the changes I found this post:

It is not correct to simply replace asyncio.get_event_loop() with asyncio.new_event_loop() because there's a number of important teardown steps that asyncio.Runner performs. Making this change will appear to work, but will silently cause problems

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

calls asyncio.get_event_loop() in a way that will fail on 3.14
2 participants