public inbox for git-commits@fedoraproject.org
help / color / mirror / Atom feed
* [rpms/python-distributed] rawhide: Workaround a Python 3.15 regression in exceptions handling
@ 2026-06-18 11:49 
  0 siblings, 0 replies; only message in thread
From:  @ 2026-06-18 11:49 UTC (permalink / raw)
  To: git-commits

            A new commit has been pushed.

            Repo   : rpms/python-distributed
            Branch : rawhide
            Commit : e494ddfaf1f70efbeed5dcf03aa3538edcd7207a
            Author : Miro Hrončok <miro@hroncok.cz>
            Date   : 2026-06-18T12:13:23+02:00
            Stats  : +48/-0 in 2 file(s)
            URL    : https://src.fedoraproject.org/rpms/python-distributed/c/e494ddfaf1f70efbeed5dcf03aa3538edcd7207a?branch=rawhide

            Log:
            Workaround a Python 3.15 regression in exceptions handling

Assisted-By: Claude Opus 4.6

---
diff --git a/0008-Don-t-chain-ModuleNotFoundError-when-raising-Runtime.patch b/0008-Don-t-chain-ModuleNotFoundError-when-raising-Runtime.patch
new file mode 100644
index 0000000..e9f0792
--- /dev/null
+++ b/0008-Don-t-chain-ModuleNotFoundError-when-raising-Runtime.patch
@@ -0,0 +1,44 @@
+From c4e4aa0f3326273c49e0b9732141e186b1e6e080 Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?Miro=20Hron=C4=8Dok?= <miro@hroncok.cz>
+Date: Thu, 18 Jun 2026 12:12:23 +0200
+Subject: [PATCH] Don't chain ModuleNotFoundError when raising RuntimeError for
+ missing conda
+
+When conda is not installed, the _CondaInstaller raises RuntimeError
+inside an except ModuleNotFoundError block. In Python 3.15, the new
+_find_incompatible_extension_module() in traceback.py tries to import
+the parent package when formatting ModuleNotFoundError tracebacks. If
+sys.modules contains None for the package (e.g. during mock.patch.dict
+in tests, or when the import was halted), this triggers another
+ModuleNotFoundError during traceback formatting.
+
+Use 'from None' to suppress both explicit and implicit exception
+chaining, preventing the ModuleNotFoundError from being attached
+as __cause__ or __context__.
+---
+ distributed/diagnostics/plugin.py | 4 ++--
+ 1 file changed, 2 insertions(+), 2 deletions(-)
+
+diff --git a/distributed/diagnostics/plugin.py b/distributed/diagnostics/plugin.py
+index 54bea73..9d9b1bb 100644
+--- a/distributed/diagnostics/plugin.py
++++ b/distributed/diagnostics/plugin.py
+@@ -645,13 +645,13 @@ class _CondaInstaller:
+         )
+         try:
+             from conda.cli.python_api import Commands, run_command
+-        except ModuleNotFoundError as e:  # pragma: nocover
++        except ModuleNotFoundError:  # pragma: nocover
+             msg = (
+                 "conda install failed because conda could not be found. "
+                 "Please make sure that conda is installed."
+             )
+             logger.error(msg)
+-            raise RuntimeError(msg) from e
++            raise RuntimeError(msg) from None
+         try:
+             _, stderr, returncode = run_command(
+                 Commands.INSTALL, self.conda_options + self.packages
+-- 
+2.54.0
+

diff --git a/python-distributed.spec b/python-distributed.spec
index 8abb155..52e7360 100644
--- a/python-distributed.spec
+++ b/python-distributed.spec
@@ -44,6 +44,10 @@ Patch:          0005-Skip-doc-test-when-not-running-from-a-git-checkout.patch
 Patch:          0006-Update-make_tls_certs.py-work-with-openssl-3-8701.patch
 # Point the test at the uninstalled version.
 Patch:          0007-Avoid-using-sys.prefix-in-CLI-test.patch
+# Temporary workaround: don't chain ModuleNotFoundError to avoid Python 3.15
+# _find_incompatible_extension_module raising during traceback formatting.
+# https://github.com/python/cpython/issues/151631
+Patch:          0008-Don-t-chain-ModuleNotFoundError-when-raising-Runtime.patch
 
 BuildArch:      noarch
 

^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2026-06-18 11:49 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-06-18 11:49 [rpms/python-distributed] rawhide: Workaround a Python 3.15 regression in exceptions handling 

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox