Skip to content

Conversation

@basnijholt
Copy link
Member

@basnijholt basnijholt commented Dec 12, 2025

Summary

  • Fix AsyncRunner instantiation failure on Python 3.14 where asyncio.get_event_loop() raises RuntimeError when no event loop is running
  • Add _get_or_create_event_loop() helper that uses get_running_loop() with fallback to new_event_loop()
  • Add Python 3.14 to CI matrix

Test plan

  • Existing tests pass on Python 3.14

Fixes #489

…) removal

In Python 3.14, asyncio.get_event_loop() raises RuntimeError when no event
loop is running. Replace with a version-agnostic approach that:
1. Tries asyncio.get_running_loop() first
2. Falls back to creating a new event loop if none exists

This works on Python 3.7+ and handles all cases correctly.

Fixes #489
@basnijholt basnijholt force-pushed the fix-python314-asyncio-get-event-loop branch from d94be19 to cfc886b Compare December 12, 2025 17:26
@basnijholt basnijholt merged commit 156778d into main Dec 12, 2025
17 of 18 checks passed
@basnijholt basnijholt deleted the fix-python314-asyncio-get-event-loop branch December 12, 2025 17:39
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.

AsyncRunner fails on Python 3.14 due to asyncio.get_event_loop() removal

2 participants