public inbox for git-commits@fedoraproject.org
help / color / mirror / Atom feed
* [rpms/python-astroid] rawhide: Fix is_namespace() crash with namespace packages on Python 3.15
@ 2026-06-12 15:43 Lumir Balhar
  0 siblings, 0 replies; only message in thread
From: Lumir Balhar @ 2026-06-12 15:43 UTC (permalink / raw)
  To: git-commits

A new commit has been pushed.

Repo   : rpms/python-astroid
Branch : rawhide
Commit : adb5804953cac6f2e1412ed5c8139374219e45c3
Author : Lumir Balhar <lbalhar@redhat.com>
Date   : 2026-06-06T16:17:13+02:00
Stats  : +30/-0 in 2 file(s)
URL    : https://src.fedoraproject.org/rpms/python-astroid/c/adb5804953cac6f2e1412ed5c8139374219e45c3?branch=rawhide

Log:
Fix is_namespace() crash with namespace packages on Python 3.15

---
diff --git a/fix-py315-is-namespace.patch b/fix-py315-is-namespace.patch
new file mode 100644
index 0000000..d281894
--- /dev/null
+++ b/fix-py315-is-namespace.patch
@@ -0,0 +1,27 @@
+# Fix is_namespace() compatibility with Python 3.15
+#
+# In Python 3.15, NamespacePath.__init__ eagerly calls _get_parent_path(),
+# which raises ModuleNotFoundError (instead of KeyError) when the parent
+# namespace package is not yet in sys.modules. Broaden the except clause
+# to catch both, as was done in the prior handler for the ValueError path.
+#
+# Backported from upstream astroid PR #3035 (released in 4.2.0b3):
+# https://github.com/pylint-dev/astroid/pull/3035
+diff --git a/astroid/interpreter/_import/util.py b/astroid/interpreter/_import/util.py
+--- a/astroid/interpreter/_import/util.py
++++ b/astroid/interpreter/_import/util.py
+@@ -72,10 +72,10 @@
+                 # Workaround for "py" module
+                 # https://github.com/pytest-dev/apipkg/issues/13
+                 return False
+-        except KeyError:
+-            # Intermediate steps might raise KeyErrors
+-            # https://github.com/python/cpython/issues/93334
+-            # TODO: update if fixed in importlib
++        # PY314: When dropping support for 3.14, replace with just
++        # except ModuleNotFoundError:
++        except (KeyError, ModuleNotFoundError):
++            # Intermediate steps might raise ModuleNotFoundError
+             # For tree a > b > c.py
+             # >>> from importlib.machinery import PathFinder
+             # >>> PathFinder.find_spec('a.b', ['a'])

diff --git a/python-astroid.spec b/python-astroid.spec
index 36b0ad6..087be94 100644
--- a/python-astroid.spec
+++ b/python-astroid.spec
@@ -15,6 +15,9 @@ Source0:        https://github.com/pylint-dev/%{srcname}/archive/v%{version}/%{s
 Patch:          fix-python315-compatibility.patch
 # Fix KW_ONLY sentinel and namespace .pth test behavior on Python 3.15
 Patch:          https://github.com/pylint-dev/astroid/pull/3047.patch
+# Fix is_namespace() crash with namespace packages on Python 3.15
+# https://github.com/pylint-dev/astroid/pull/3035
+Patch:          fix-py315-is-namespace.patch
 
 BuildArch:      noarch
 

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

only message in thread, other threads:[~2026-06-12 15:43 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-06-12 15:43 [rpms/python-astroid] rawhide: Fix is_namespace() crash with namespace packages on Python 3.15 Lumir Balhar

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