From ee1759ce730c66a55b3fdbddc38cda6ef707ce4d Mon Sep 17 00:00:00 2001 From: Bart Oostveen Date: Fri, 10 Jul 2026 14:03:23 +0200 Subject: [PATCH] python3Packages.sqlalchemy_1_3: create new event loop if not exists This fixes the broken build: https://hydra.nixos.org/build/336830567 See also: https://github.com/NixOS/nixpkgs/pull/528120#issuecomment-4934908836 (cherry picked from commit 9b1f82d4af0068db750bac58602ced7ce54bf841) --- ...-create-new-event-loop-if-not-exists.patch | 26 +++++++++++++++++++ .../python-modules/sqlalchemy/1_3.nix | 2 ++ 2 files changed, 28 insertions(+) create mode 100644 pkgs/development/python-modules/sqlalchemy/1.3-0001-fix-create-new-event-loop-if-not-exists.patch diff --git a/pkgs/development/python-modules/sqlalchemy/1.3-0001-fix-create-new-event-loop-if-not-exists.patch b/pkgs/development/python-modules/sqlalchemy/1.3-0001-fix-create-new-event-loop-if-not-exists.patch new file mode 100644 index 000000000000..e10c13868423 --- /dev/null +++ b/pkgs/development/python-modules/sqlalchemy/1.3-0001-fix-create-new-event-loop-if-not-exists.patch @@ -0,0 +1,26 @@ +From 98fd6e87243c6d5992429a9b90426af73dbcc3ff Mon Sep 17 00:00:00 2001 +From: Bart Oostveen +Date: Fri, 10 Jul 2026 13:59:21 +0200 +Subject: [PATCH] fix: create new event loop if not exists + +--- + lib/sqlalchemy/util/_concurrency_py3k.py | 4 +++- + 1 file changed, 3 insertions(+), 1 deletion(-) + +diff --git a/lib/sqlalchemy/util/_concurrency_py3k.py b/lib/sqlalchemy/util/_concurrency_py3k.py +index 1e4ffef..5aaf12c 100644 +--- a/lib/sqlalchemy/util/_concurrency_py3k.py ++++ b/lib/sqlalchemy/util/_concurrency_py3k.py +@@ -190,6 +190,8 @@ def get_event_loop(): + try: + return asyncio.get_running_loop() + except RuntimeError: +- return asyncio.get_event_loop_policy().get_event_loop() ++ loop = asyncio.new_event_loop() ++ asyncio.set_event_loop(loop) ++ return loop + else: + return asyncio.get_event_loop() +-- +2.54.0 + diff --git a/pkgs/development/python-modules/sqlalchemy/1_3.nix b/pkgs/development/python-modules/sqlalchemy/1_3.nix index b57cd123a030..38670bc2b31c 100644 --- a/pkgs/development/python-modules/sqlalchemy/1_3.nix +++ b/pkgs/development/python-modules/sqlalchemy/1_3.nix @@ -37,6 +37,8 @@ buildPythonPackage (finalAttrs: { hash = "sha256-6qAjyqMVrugABHssAQuql3z1YHTAOSm5hARJuJXJJvo="; }; + patches = [ ./1.3-0001-fix-create-new-event-loop-if-not-exists.patch ]; + postPatch = '' sed -i '/tag_build = dev/d' setup.cfg '';