From 733620acd75d7e022c8af69bc30e4992da43f8ff Mon Sep 17 00:00:00 2001 From: Sandro Date: Mon, 13 Jul 2026 11:39:56 +0200 Subject: [PATCH] Fix SYNAPSE_ASYNC_IO_REACTOR=1 on Python 3.14 (#19949) --- changelog.d/19949.bugfix | 1 + synapse/__init__.py | 4 +++- 2 files changed, 4 insertions(+), 1 deletion(-) create mode 100644 changelog.d/19949.bugfix diff --git a/changelog.d/19949.bugfix b/changelog.d/19949.bugfix new file mode 100644 index 0000000000..24ddd4dc4f --- /dev/null +++ b/changelog.d/19949.bugfix @@ -0,0 +1 @@ +Fix `SYNAPSE_ASYNC_IO_REACTOR=1` on Python 3.14. diff --git a/synapse/__init__.py b/synapse/__init__.py index 3acfc1a0d7..a223066f04 100644 --- a/synapse/__init__.py +++ b/synapse/__init__.py @@ -49,7 +49,9 @@ if strtobool(os.environ.get("SYNAPSE_ASYNC_IO_REACTOR", "0")): from twisted.internet import asyncioreactor - asyncioreactor.install(asyncio.get_event_loop()) + loop = asyncio.new_event_loop() + asyncio.set_event_loop(loop) + asyncioreactor.install(loop) # Twisted and canonicaljson will fail to import when this file is executed to # get the __version__ during a fresh install. That's OK and subsequent calls to