public inbox for git-commits@fedoraproject.org
help / color / mirror / Atom feed
To: git-commits@fedoraproject.org
Subject: [rpms/python-distributed] rawhide: Workaround a Python 3.15 regression in exceptions handling
Date: Thu, 18 Jun 2026 11:49:07 GMT	[thread overview]
Message-ID: <178178334793.1.1711797229391768420.rpms-python-distributed-e494ddfaf1f7@fedoraproject.org> (raw)

            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
 

                 reply	other threads:[~2026-06-18 11:49 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=178178334793.1.1711797229391768420.rpms-python-distributed-e494ddfaf1f7@fedoraproject.org \
    --to=git-commits@fedoraproject.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox