public inbox for git-commits@fedoraproject.org
help / color / mirror / Atom feed
* [rpms/python-astroid] rawhide: 4.3.1
@ 2026-08-17 20:14 Gwyn Ciesla
  0 siblings, 0 replies; only message in thread
From: Gwyn Ciesla @ 2026-08-17 20:14 UTC (permalink / raw)
  To: git-commits

A new commit has been pushed.

Repo   : rpms/python-astroid
Branch : rawhide
Commit : d2d0a5331c2eb94ac9433fa4023e4946fe58ffba
Author : Gwyn Ciesla <gwync@protonmail.com>
Date   : 2026-08-17T15:14:16-05:00
Stats  : +2/-950 in 5 file(s)
URL    : https://src.fedoraproject.org/rpms/python-astroid/c/d2d0a5331c2eb94ac9433fa4023e4946fe58ffba?branch=rawhide

Log:
4.3.1

---
diff --git a/3047.patch b/3047.patch
deleted file mode 100644
index 53152b7..0000000
--- a/3047.patch
+++ /dev/null
@@ -1,771 +0,0 @@
-From da2d32a1cd850b8a6f0f38104ac77df974dcd7d8 Mon Sep 17 00:00:00 2001
-From: SAY-5 <SAY-5@users.noreply.github.com>
-Date: Sat, 9 May 2026 01:53:58 -0700
-Subject: [PATCH 01/12] fix: handle Python 3.15 KW_ONLY and .pth test changes
-
----
- astroid/brain/brain_dataclasses.py | 25 +++++++++++++++++++++----
- tests/test_manager.py              | 26 +++++++++++++++++++-------
- 2 files changed, 40 insertions(+), 11 deletions(-)
-
-diff --git a/astroid/brain/brain_dataclasses.py b/astroid/brain/brain_dataclasses.py
-index b6b1956614..61cc9ade93 100644
---- a/astroid/brain/brain_dataclasses.py
-+++ b/astroid/brain/brain_dataclasses.py
-@@ -571,10 +571,27 @@ def _get_field_default(field_call: nodes.Call) -> _FieldDefaultReturn:
- def _is_keyword_only_sentinel(node: nodes.NodeNG) -> bool:
-     """Return True if node is the KW_ONLY sentinel."""
-     inferred = safe_infer(node)
--    return (
--        isinstance(inferred, bases.Instance)
--        and inferred.qname() == "dataclasses._KW_ONLY_TYPE"
--    )
-+    if not isinstance(inferred, bases.Instance):
-+        return False
-+    if inferred.qname() == "dataclasses._KW_ONLY_TYPE":
-+        return True
-+    if inferred.qname() != "builtins.sentinel":
-+        return False
-+    if isinstance(node, nodes.Name):
-+        _, assignments = node.lookup(node.name)
-+        return any(
-+            isinstance(assignment, nodes.ImportFrom)
-+            and assignment.modname == "dataclasses"
-+            and any(imported == "KW_ONLY" for imported, _ in assignment.names)
-+            for assignment in assignments
-+        )
-+    if isinstance(node, nodes.Attribute) and node.attrname == "KW_ONLY":
-+        inferred_expr = safe_infer(node.expr)
-+        return (
-+            isinstance(inferred_expr, nodes.Module)
-+            and inferred_expr.qname() == "dataclasses"
-+        )
-+    return False
- 
- 
- def _is_init_var(node: nodes.NodeNG) -> bool:
-diff --git a/tests/test_manager.py b/tests/test_manager.py
-index e420e6b150..b5cadbf7f5 100644
---- a/tests/test_manager.py
-+++ b/tests/test_manager.py
-@@ -3,7 +3,6 @@
- # Copyright (c) https://github.com/pylint-dev/astroid/blob/main/CONTRIBUTORS.txt
- 
- import os
--import site
- import sys
- import time
- import unittest
-@@ -36,6 +35,16 @@ def _get_file_from_object(obj) -> str:
-     return obj.__file__
- 
- 
-+def _load_namespace_package_pth(pth: str) -> None:
-+    """Execute a test .pth file with a real sitedir local."""
-+    sitedir = str(resources.RESOURCE_PATH)
-+    with (resources.RESOURCE_PATH / pth).open(encoding="utf-8") as pth_file:
-+        for line in pth_file:
-+            line = line.strip()
-+            if line and not line.startswith("#"):
-+                exec(line)
-+
-+
- class AstroidManagerTest(resources.SysPathSetup, unittest.TestCase):
-     def setUp(self) -> None:
-         super().setUp()
-@@ -196,7 +205,7 @@ def test_implicit_namespace_package(self) -> None:
-     )
-     def test_namespace_package_pth_support(self) -> None:
-         pth = "foogle_fax-0.12.5-py2.7-nspkg.pth"
--        site.addpackage(resources.RESOURCE_PATH, pth, [])
-+        _load_namespace_package_pth(pth)
- 
-         try:
-             module = self.manager.ast_from_module_name("foogle.fax")
-@@ -206,7 +215,8 @@ def test_namespace_package_pth_support(self) -> None:
-             with self.assertRaises(AstroidImportError):
-                 self.manager.ast_from_module_name("foogle.moogle")
-         finally:
--            sys.modules.pop("foogle")
-+            sys.modules.pop("foogle", None)
-+            sys.modules.pop("foogle.crank", None)
- 
-     @pytest.mark.skipif(
-         IS_PYPY,
-@@ -214,23 +224,25 @@ def test_namespace_package_pth_support(self) -> None:
-     )
-     def test_nested_namespace_import(self) -> None:
-         pth = "foogle_fax-0.12.5-py2.7-nspkg.pth"
--        site.addpackage(resources.RESOURCE_PATH, pth, [])
-+        _load_namespace_package_pth(pth)
-         try:
-             self.manager.ast_from_module_name("foogle.crank")
-         finally:
--            sys.modules.pop("foogle")
-+            sys.modules.pop("foogle", None)
-+            sys.modules.pop("foogle.crank", None)
- 
-     def test_namespace_and_file_mismatch(self) -> None:
-         filepath = unittest.__file__
-         ast = self.manager.ast_from_file(filepath)
-         self.assertEqual(ast.name, "unittest")
-         pth = "foogle_fax-0.12.5-py2.7-nspkg.pth"
--        site.addpackage(resources.RESOURCE_PATH, pth, [])
-+        _load_namespace_package_pth(pth)
-         try:
-             with self.assertRaises(AstroidImportError):
-                 self.manager.ast_from_module_name("unittest.foogle.fax")
-         finally:
--            sys.modules.pop("foogle")
-+            sys.modules.pop("foogle", None)
-+            sys.modules.pop("foogle.crank", None)
- 
-     def _test_ast_from_zip(self, archive: str) -> None:
-         sys.modules.pop("mypypa", None)
-
-From 2838260ad2fa17ef34b776b095ae1a2323d4f838 Mon Sep 17 00:00:00 2001
-From: SAY-5 <SAY-5@users.noreply.github.com>
-Date: Sun, 10 May 2026 02:25:43 -0700
-Subject: [PATCH 02/12] style: silence pylint in namespace .pth helper
-
----
- tests/test_manager.py | 4 ++--
- 1 file changed, 2 insertions(+), 2 deletions(-)
-
-diff --git a/tests/test_manager.py b/tests/test_manager.py
-index b5cadbf7f5..66d99e6984 100644
---- a/tests/test_manager.py
-+++ b/tests/test_manager.py
-@@ -37,12 +37,12 @@ def _get_file_from_object(obj) -> str:
- 
- def _load_namespace_package_pth(pth: str) -> None:
-     """Execute a test .pth file with a real sitedir local."""
--    sitedir = str(resources.RESOURCE_PATH)
-+    sitedir = str(resources.RESOURCE_PATH)  # pylint: disable=unused-variable
-     with (resources.RESOURCE_PATH / pth).open(encoding="utf-8") as pth_file:
-         for line in pth_file:
-             line = line.strip()
-             if line and not line.startswith("#"):
--                exec(line)
-+                exec(line)  # pylint: disable=exec-used
- 
- 
- class AstroidManagerTest(resources.SysPathSetup, unittest.TestCase):
-
-From a88b18105b57167465ecdbae9c2a2436dbe83703 Mon Sep 17 00:00:00 2001
-From: SAY-5 <SAY-5@users.noreply.github.com>
-Date: Sun, 10 May 2026 02:29:35 -0700
-Subject: [PATCH 03/12] style: satisfy ruff in namespace .pth helper
-
----
- tests/test_manager.py | 3 ++-
- 1 file changed, 2 insertions(+), 1 deletion(-)
-
-diff --git a/tests/test_manager.py b/tests/test_manager.py
-index 66d99e6984..e60772f19d 100644
---- a/tests/test_manager.py
-+++ b/tests/test_manager.py
-@@ -37,7 +37,8 @@ def _get_file_from_object(obj) -> str:
- 
- def _load_namespace_package_pth(pth: str) -> None:
-     """Execute a test .pth file with a real sitedir local."""
--    sitedir = str(resources.RESOURCE_PATH)  # pylint: disable=unused-variable
-+    sitedir = str(resources.RESOURCE_PATH)
-+    _ = sitedir
-     with (resources.RESOURCE_PATH / pth).open(encoding="utf-8") as pth_file:
-         for line in pth_file:
-             line = line.strip()
-
-From 57991bd70970d91416e197bf4068dbcb6dc7e599 Mon Sep 17 00:00:00 2001
-From: Sai Asish Y <saiasish.cnp@gmail.com>
-Date: Sun, 10 May 2026 15:11:55 -0700
-Subject: [PATCH 04/12] refactor: drop `_ = sitedir` placeholder, use
- noqa+docstring
-
----
- tests/test_manager.py | 10 +++++++---
- 1 file changed, 7 insertions(+), 3 deletions(-)
-
-diff --git a/tests/test_manager.py b/tests/test_manager.py
-index e60772f19d..20796d5303 100644
---- a/tests/test_manager.py
-+++ b/tests/test_manager.py
-@@ -36,9 +36,13 @@ def _get_file_from_object(obj) -> str:
- 
- 
- def _load_namespace_package_pth(pth: str) -> None:
--    """Execute a test .pth file with a real sitedir local."""
--    sitedir = str(resources.RESOURCE_PATH)
--    _ = sitedir
-+    """Execute a test .pth file with a `sitedir` local in scope.
-+
-+    The .pth fixture reads `sys._getframe(1).f_locals['sitedir']`, so the
-+    name must exist as a real local in this function's frame; static
-+    analyzers cannot see the use through `exec`.
-+    """
-+    sitedir = str(resources.RESOURCE_PATH)  # noqa: F841 # used by exec'd .pth
-     with (resources.RESOURCE_PATH / pth).open(encoding="utf-8") as pth_file:
-         for line in pth_file:
-             line = line.strip()
-
-From 13bcb87d54ea1914ccf854f4c557b53a154e2929 Mon Sep 17 00:00:00 2001
-From: SAY-5 <say.apm35@gmail.com>
-Date: Mon, 11 May 2026 10:37:06 -0700
-Subject: [PATCH 05/12] test: silence pylint unused-variable for exec-bound
- sitedir
-
-Signed-off-by: SAY-5 <say.apm35@gmail.com>
----
- tests/test_manager.py | 2 +-
- 1 file changed, 1 insertion(+), 1 deletion(-)
-
-diff --git a/tests/test_manager.py b/tests/test_manager.py
-index 20796d5303..89eda1ae27 100644
---- a/tests/test_manager.py
-+++ b/tests/test_manager.py
-@@ -42,7 +42,7 @@ def _load_namespace_package_pth(pth: str) -> None:
-     name must exist as a real local in this function's frame; static
-     analyzers cannot see the use through `exec`.
-     """
--    sitedir = str(resources.RESOURCE_PATH)  # noqa: F841 # used by exec'd .pth
-+    sitedir = str(resources.RESOURCE_PATH)  # noqa: F841 # pylint: disable=unused-variable  # used by exec'd .pth
-     with (resources.RESOURCE_PATH / pth).open(encoding="utf-8") as pth_file:
-         for line in pth_file:
-             line = line.strip()
-
-From 5627f7c4cf4cdc64c7929e7ea00c9398ac0f1cd5 Mon Sep 17 00:00:00 2001
-From: "pre-commit-ci[bot]"
- <66853113+pre-commit-ci[bot]@users.noreply.github.com>
-Date: Mon, 11 May 2026 17:37:29 +0000
-Subject: [PATCH 06/12] [pre-commit.ci] auto fixes from pre-commit.com hooks
-
-for more information, see https://pre-commit.ci
----
- tests/test_manager.py | 4 +++-
- 1 file changed, 3 insertions(+), 1 deletion(-)
-
-diff --git a/tests/test_manager.py b/tests/test_manager.py
-index 89eda1ae27..9e6cf8c16d 100644
---- a/tests/test_manager.py
-+++ b/tests/test_manager.py
-@@ -42,7 +42,9 @@ def _load_namespace_package_pth(pth: str) -> None:
-     name must exist as a real local in this function's frame; static
-     analyzers cannot see the use through `exec`.
-     """
--    sitedir = str(resources.RESOURCE_PATH)  # noqa: F841 # pylint: disable=unused-variable  # used by exec'd .pth
-+    sitedir = str(
-+        resources.RESOURCE_PATH
-+    )  # noqa: F841 # pylint: disable=unused-variable  # used by exec'd .pth
-     with (resources.RESOURCE_PATH / pth).open(encoding="utf-8") as pth_file:
-         for line in pth_file:
-             line = line.strip()
-
-From df18f292c837cdf0eb3dd054bf918b6cc4f7c040 Mon Sep 17 00:00:00 2001
-From: SAY-5 <say.apm35@gmail.com>
-Date: Mon, 11 May 2026 10:40:23 -0700
-Subject: [PATCH 07/12] test: keep noqa+pylint disable on one line for
- exec-bound sitedir
-
-Signed-off-by: SAY-5 <say.apm35@gmail.com>
----
- tests/test_manager.py | 45 ++++++++++++-------------------------------
- 1 file changed, 12 insertions(+), 33 deletions(-)
-
-diff --git a/tests/test_manager.py b/tests/test_manager.py
-index 9e6cf8c16d..e627499fd4 100644
---- a/tests/test_manager.py
-+++ b/tests/test_manager.py
-@@ -42,9 +42,8 @@ def _load_namespace_package_pth(pth: str) -> None:
-     name must exist as a real local in this function's frame; static
-     analyzers cannot see the use through `exec`.
-     """
--    sitedir = str(
--        resources.RESOURCE_PATH
--    )  # noqa: F841 # pylint: disable=unused-variable  # used by exec'd .pth
-+    # `sitedir` is read by exec()'d .pth code via sys._getframe; intentional.
-+    sitedir = str(resources.RESOURCE_PATH)  # pylint: disable=unused-variable  # noqa: F841
-     with (resources.RESOURCE_PATH / pth).open(encoding="utf-8") as pth_file:
-         for line in pth_file:
-             line = line.strip()
-@@ -78,9 +77,7 @@ def test_ast_from_file_astro_builder(self) -> None:
-         self.assertIn("unittest", self.manager.astroid_cache)
- 
-     def test_ast_from_file_name_astro_builder_exception(self) -> None:
--        self.assertRaises(
--            AstroidBuildingError, self.manager.ast_from_file, "unhandledName"
--        )
-+        self.assertRaises(AstroidBuildingError, self.manager.ast_from_file, "unhandledName")
- 
-     def test_ast_from_string(self) -> None:
-         filepath = unittest.__file__
-@@ -146,14 +143,10 @@ def test_identify_old_namespace_package_protocol(self) -> None:
-             # pylint: disable-next=import-outside-toplevel
-             import tests.testdata.python3.data.path_pkg_resources_1.package.foo as _  # noqa
- 
--        self.assertTrue(
--            util.is_namespace("tests.testdata.python3.data.path_pkg_resources_1")
--        )
-+        self.assertTrue(util.is_namespace("tests.testdata.python3.data.path_pkg_resources_1"))
- 
-     def test_submodule_homonym_with_non_module(self) -> None:
--        self.assertFalse(
--            util.is_namespace("tests.testdata.python3.data.parent_of_homonym.doc")
--        )
-+        self.assertFalse(util.is_namespace("tests.testdata.python3.data.parent_of_homonym.doc"))
- 
-     def test_module_is_not_namespace(self) -> None:
-         self.assertFalse(util.is_namespace("tests.testdata.python3.data.all"))
-@@ -258,9 +251,7 @@ def _test_ast_from_zip(self, archive: str) -> None:
-         module = self.manager.ast_from_module_name("mypypa")
-         self.assertEqual(module.name, "mypypa")
-         end = os.path.join(archive, "mypypa")
--        self.assertTrue(
--            module.file.endswith(end), f"{module.file} doesn't endswith {end}"
--        )
-+        self.assertTrue(module.file.endswith(end), f"{module.file} doesn't endswith {end}")
- 
-     @contextmanager
-     def _restore_package_cache(self) -> Iterator:
-@@ -278,21 +269,15 @@ def _restore_package_cache(self) -> Iterator:
- 
-     def test_ast_from_module_name_egg(self) -> None:
-         with self._restore_package_cache():
--            self._test_ast_from_zip(
--                os.path.sep.join(["data", os.path.normcase("MyPyPa-0.1.0-py2.5.egg")])
--            )
-+            self._test_ast_from_zip(os.path.sep.join(["data", os.path.normcase("MyPyPa-0.1.0-py2.5.egg")]))
- 
-     def test_ast_from_module_name_zip(self) -> None:
-         with self._restore_package_cache():
--            self._test_ast_from_zip(
--                os.path.sep.join(["data", os.path.normcase("MyPyPa-0.1.0-py2.5.zip")])
--            )
-+            self._test_ast_from_zip(os.path.sep.join(["data", os.path.normcase("MyPyPa-0.1.0-py2.5.zip")]))
- 
-     def test_ast_from_module_name_pyz(self) -> None:
-         try:
--            linked_file_name = os.path.join(
--                resources.RESOURCE_PATH, "MyPyPa-0.1.0-py2.5.pyz"
--            )
-+            linked_file_name = os.path.join(resources.RESOURCE_PATH, "MyPyPa-0.1.0-py2.5.pyz")
-             os.symlink(
-                 os.path.join(resources.RESOURCE_PATH, "MyPyPa-0.1.0-py2.5.zip"),
-                 linked_file_name,
-@@ -310,9 +295,7 @@ def test_ast_from_module_name_pyz_with_submodule(self) -> None:
-             module = self.manager.ast_from_module_name("xxx.test")
-             self.assertEqual(module.name, "xxx.test")
-             end = os.path.join(archive_path, "xxx", "test")
--            self.assertTrue(
--                module.file.endswith(end), f"{module.file} doesn't endswith {end}"
--            )
-+            self.assertTrue(module.file.endswith(end), f"{module.file} doesn't endswith {end}")
- 
-     def test_zip_import_data(self) -> None:
-         """Check if zip_import_data works."""
-@@ -506,9 +489,7 @@ def test_clear_cache_clears_other_lru_caches(self) -> None:
- 
-         # Did the hits or misses actually happen?
-         incremented_cache_infos = [lru.cache_info() for lru in lrus]
--        for incremented_cache, baseline_cache in zip(
--            incremented_cache_infos, baseline_cache_infos
--        ):
-+        for incremented_cache, baseline_cache in zip(incremented_cache_infos, baseline_cache_infos):
-             with self.subTest(incremented_cache=incremented_cache):
-                 self.assertGreater(
-                     incremented_cache.hits + incremented_cache.misses,
-@@ -521,9 +502,7 @@ def test_clear_cache_clears_other_lru_caches(self) -> None:
- 
-         # The cache sizes are now as low or lower than the original baseline
-         cleared_cache_infos = [lru.cache_info() for lru in lrus]
--        for cleared_cache, baseline_cache in zip(
--            cleared_cache_infos, baseline_cache_infos
--        ):
-+        for cleared_cache, baseline_cache in zip(cleared_cache_infos, baseline_cache_infos):
-             with self.subTest(cleared_cache=cleared_cache):
-                 # less equal because the "baseline" might have had multiple calls to bootstrap()
-                 self.assertLessEqual(cleared_cache.currsize, baseline_cache.currsize)
-
-From 709964c9181c7de90db6c4fe07df2e0cc22c263e Mon Sep 17 00:00:00 2001
-From: "pre-commit-ci[bot]"
- <66853113+pre-commit-ci[bot]@users.noreply.github.com>
-Date: Mon, 11 May 2026 17:40:43 +0000
-Subject: [PATCH 08/12] [pre-commit.ci] auto fixes from pre-commit.com hooks
-
-for more information, see https://pre-commit.ci
----
- tests/test_manager.py | 44 ++++++++++++++++++++++++++++++++-----------
- 1 file changed, 33 insertions(+), 11 deletions(-)
-
-diff --git a/tests/test_manager.py b/tests/test_manager.py
-index e627499fd4..bce419a53e 100644
---- a/tests/test_manager.py
-+++ b/tests/test_manager.py
-@@ -43,7 +43,9 @@ def _load_namespace_package_pth(pth: str) -> None:
-     analyzers cannot see the use through `exec`.
-     """
-     # `sitedir` is read by exec()'d .pth code via sys._getframe; intentional.
--    sitedir = str(resources.RESOURCE_PATH)  # pylint: disable=unused-variable  # noqa: F841
-+    sitedir = str(
-+        resources.RESOURCE_PATH
-+    )  # pylint: disable=unused-variable  # noqa: F841
-     with (resources.RESOURCE_PATH / pth).open(encoding="utf-8") as pth_file:
-         for line in pth_file:
-             line = line.strip()
-@@ -77,7 +79,9 @@ def test_ast_from_file_astro_builder(self) -> None:
-         self.assertIn("unittest", self.manager.astroid_cache)
- 
-     def test_ast_from_file_name_astro_builder_exception(self) -> None:
--        self.assertRaises(AstroidBuildingError, self.manager.ast_from_file, "unhandledName")
-+        self.assertRaises(
-+            AstroidBuildingError, self.manager.ast_from_file, "unhandledName"
-+        )
- 
-     def test_ast_from_string(self) -> None:
-         filepath = unittest.__file__
-@@ -143,10 +147,14 @@ def test_identify_old_namespace_package_protocol(self) -> None:
-             # pylint: disable-next=import-outside-toplevel
-             import tests.testdata.python3.data.path_pkg_resources_1.package.foo as _  # noqa
- 
--        self.assertTrue(util.is_namespace("tests.testdata.python3.data.path_pkg_resources_1"))
-+        self.assertTrue(
-+            util.is_namespace("tests.testdata.python3.data.path_pkg_resources_1")
-+        )
- 
-     def test_submodule_homonym_with_non_module(self) -> None:
--        self.assertFalse(util.is_namespace("tests.testdata.python3.data.parent_of_homonym.doc"))
-+        self.assertFalse(
-+            util.is_namespace("tests.testdata.python3.data.parent_of_homonym.doc")
-+        )
- 
-     def test_module_is_not_namespace(self) -> None:
-         self.assertFalse(util.is_namespace("tests.testdata.python3.data.all"))
-@@ -251,7 +259,9 @@ def _test_ast_from_zip(self, archive: str) -> None:
-         module = self.manager.ast_from_module_name("mypypa")
-         self.assertEqual(module.name, "mypypa")
-         end = os.path.join(archive, "mypypa")
--        self.assertTrue(module.file.endswith(end), f"{module.file} doesn't endswith {end}")
-+        self.assertTrue(
-+            module.file.endswith(end), f"{module.file} doesn't endswith {end}"
-+        )
- 
-     @contextmanager
-     def _restore_package_cache(self) -> Iterator:
-@@ -269,15 +279,21 @@ def _restore_package_cache(self) -> Iterator:
- 
-     def test_ast_from_module_name_egg(self) -> None:
-         with self._restore_package_cache():
--            self._test_ast_from_zip(os.path.sep.join(["data", os.path.normcase("MyPyPa-0.1.0-py2.5.egg")]))
-+            self._test_ast_from_zip(
-+                os.path.sep.join(["data", os.path.normcase("MyPyPa-0.1.0-py2.5.egg")])
-+            )
- 
-     def test_ast_from_module_name_zip(self) -> None:
-         with self._restore_package_cache():
--            self._test_ast_from_zip(os.path.sep.join(["data", os.path.normcase("MyPyPa-0.1.0-py2.5.zip")]))
-+            self._test_ast_from_zip(
-+                os.path.sep.join(["data", os.path.normcase("MyPyPa-0.1.0-py2.5.zip")])
-+            )
- 
-     def test_ast_from_module_name_pyz(self) -> None:
-         try:
--            linked_file_name = os.path.join(resources.RESOURCE_PATH, "MyPyPa-0.1.0-py2.5.pyz")
-+            linked_file_name = os.path.join(
-+                resources.RESOURCE_PATH, "MyPyPa-0.1.0-py2.5.pyz"
-+            )
-             os.symlink(
-                 os.path.join(resources.RESOURCE_PATH, "MyPyPa-0.1.0-py2.5.zip"),
-                 linked_file_name,
-@@ -295,7 +311,9 @@ def test_ast_from_module_name_pyz_with_submodule(self) -> None:
-             module = self.manager.ast_from_module_name("xxx.test")
-             self.assertEqual(module.name, "xxx.test")
-             end = os.path.join(archive_path, "xxx", "test")
--            self.assertTrue(module.file.endswith(end), f"{module.file} doesn't endswith {end}")
-+            self.assertTrue(
-+                module.file.endswith(end), f"{module.file} doesn't endswith {end}"
-+            )
- 
-     def test_zip_import_data(self) -> None:
-         """Check if zip_import_data works."""
-@@ -489,7 +507,9 @@ def test_clear_cache_clears_other_lru_caches(self) -> None:
- 
-         # Did the hits or misses actually happen?
-         incremented_cache_infos = [lru.cache_info() for lru in lrus]
--        for incremented_cache, baseline_cache in zip(incremented_cache_infos, baseline_cache_infos):
-+        for incremented_cache, baseline_cache in zip(
-+            incremented_cache_infos, baseline_cache_infos
-+        ):
-             with self.subTest(incremented_cache=incremented_cache):
-                 self.assertGreater(
-                     incremented_cache.hits + incremented_cache.misses,
-@@ -502,7 +522,9 @@ def test_clear_cache_clears_other_lru_caches(self) -> None:
- 
-         # The cache sizes are now as low or lower than the original baseline
-         cleared_cache_infos = [lru.cache_info() for lru in lrus]
--        for cleared_cache, baseline_cache in zip(cleared_cache_infos, baseline_cache_infos):
-+        for cleared_cache, baseline_cache in zip(
-+            cleared_cache_infos, baseline_cache_infos
-+        ):
-             with self.subTest(cleared_cache=cleared_cache):
-                 # less equal because the "baseline" might have had multiple calls to bootstrap()
-                 self.assertLessEqual(cleared_cache.currsize, baseline_cache.currsize)
-
-From 55bb0d66d337fbf2a4102fe24adc7fd20dc1c9f5 Mon Sep 17 00:00:00 2001
-From: Sai Asish Y <say.apm35@gmail.com>
-Date: Mon, 11 May 2026 14:00:26 -0700
-Subject: [PATCH 09/12] fix(tests): suppress ruff F841 by reading sitedir local
-
----
- tests/test_manager.py | 11 +++++------
- 1 file changed, 5 insertions(+), 6 deletions(-)
-
-diff --git a/tests/test_manager.py b/tests/test_manager.py
-index bce419a53e..8644e3e8d1 100644
---- a/tests/test_manager.py
-+++ b/tests/test_manager.py
-@@ -39,17 +39,16 @@ def _load_namespace_package_pth(pth: str) -> None:
-     """Execute a test .pth file with a `sitedir` local in scope.
- 
-     The .pth fixture reads `sys._getframe(1).f_locals['sitedir']`, so the
--    name must exist as a real local in this function's frame; static
--    analyzers cannot see the use through `exec`.
-+    name must exist as a real local in this function's frame; the read
-+    happens via `sys._getframe` inside `exec()`d code below.
-     """
--    # `sitedir` is read by exec()'d .pth code via sys._getframe; intentional.
--    sitedir = str(
--        resources.RESOURCE_PATH
--    )  # pylint: disable=unused-variable  # noqa: F841
-+    sitedir = str(resources.RESOURCE_PATH)
-     with (resources.RESOURCE_PATH / pth).open(encoding="utf-8") as pth_file:
-         for line in pth_file:
-             line = line.strip()
-             if line and not line.startswith("#"):
-+                # `sitedir` is read by .pth code via sys._getframe(1).f_locals.
-+                _ = sitedir  # mark as used for static analyzers
-                 exec(line)  # pylint: disable=exec-used
- 
- 
-
-From be1242e4f39b3ad0e8cfaead849de75966d7d9c4 Mon Sep 17 00:00:00 2001
-From: SAY-5 <say.apm35@gmail.com>
-Date: Mon, 11 May 2026 16:46:21 -0700
-Subject: [PATCH 10/12] fix(tests): parse nspkg .pth fixture instead of using
- exec
-
-Replace the exec() shim in _load_namespace_package_pth with a small regex parser that extracts the package tuple and replays the namespace-package wiring directly. Avoids running arbitrary code from the fixture line.
-
-Signed-off-by: SAY-5 <say.apm35@gmail.com>
----
- tests/test_manager.py | 50 ++++++++++++++++++++++++++++++++++---------
- 1 file changed, 40 insertions(+), 10 deletions(-)
-
-diff --git a/tests/test_manager.py b/tests/test_manager.py
-index 8644e3e8d1..00c146cc6d 100644
---- a/tests/test_manager.py
-+++ b/tests/test_manager.py
-@@ -3,8 +3,10 @@
- # Copyright (c) https://github.com/pylint-dev/astroid/blob/main/CONTRIBUTORS.txt
- 
- import os
-+import re
- import sys
- import time
-+import types
- import unittest
- import warnings
- from collections.abc import Iterator
-@@ -35,21 +37,49 @@ def _get_file_from_object(obj) -> str:
-     return obj.__file__
- 
- 
-+_NSPKG_PTH_PARTS_RE = re.compile(r"\*\(([^)]+)\)")
-+
-+
-+def _parse_pth_package_parts(line: str) -> tuple[str, ...]:
-+    """Extract the namespace package tuple from a setuptools nspkg .pth line."""
-+    match = _NSPKG_PTH_PARTS_RE.search(line)
-+    if not match:
-+        return ()
-+    parts = []
-+    for token in match.group(1).split(","):
-+        token = token.strip().strip("'\"")
-+        if token:
-+            parts.append(token)
-+    return tuple(parts)
-+
-+
- def _load_namespace_package_pth(pth: str) -> None:
--    """Execute a test .pth file with a `sitedir` local in scope.
-+    """Apply a setuptools-style namespace package .pth fixture without exec().
- 
--    The .pth fixture reads `sys._getframe(1).f_locals['sitedir']`, so the
--    name must exist as a real local in this function's frame; the read
--    happens via `sys._getframe` inside `exec()`d code below.
-+    Each non-comment line in the fixture wires up one namespace package by
-+    appending a directory under `resources.RESOURCE_PATH` to that package's
-+    ``__path__``. We parse the package tuple out of the line and replay the
-+    same effect here.
-     """
-     sitedir = str(resources.RESOURCE_PATH)
-     with (resources.RESOURCE_PATH / pth).open(encoding="utf-8") as pth_file:
--        for line in pth_file:
--            line = line.strip()
--            if line and not line.startswith("#"):
--                # `sitedir` is read by .pth code via sys._getframe(1).f_locals.
--                _ = sitedir  # mark as used for static analyzers
--                exec(line)  # pylint: disable=exec-used
-+        for raw_line in pth_file:
-+            line = raw_line.strip()
-+            if not line or line.startswith("#"):
-+                continue
-+            parts = _parse_pth_package_parts(line)
-+            if not parts:
-+                continue
-+            package_name = ".".join(parts)
-+            package_path = os.path.join(sitedir, *parts)
-+            if os.path.exists(os.path.join(package_path, "__init__.py")):
-+                continue
-+            module = sys.modules.setdefault(
-+                package_name, types.ModuleType(package_name)
-+            )
-+            mod_path = module.__dict__.setdefault("__path__", [])
-+            if package_path not in mod_path:
-+                mod_path.append(package_path)
- 
- 
- class AstroidManagerTest(resources.SysPathSetup, unittest.TestCase):
-
-From 780a3d2127037ccea8db9f3c499fec5bddc11a27 Mon Sep 17 00:00:00 2001
-From: Pierre Sassoulas <pierre.sassoulas@gmail.com>
-Date: Fri, 15 May 2026 23:09:11 +0200
-Subject: [PATCH 11/12] test: cover dataclasses.KW_ONLY attribute access and
- .pth parser
-
-Extend ``test_kw_only_sentinel`` with a third case that uses
-``dataclasses.KW_ONLY`` via ``import dataclasses`` to exercise the
-``nodes.Attribute`` branch of ``_is_keyword_only_sentinel``.
-
-Add direct unit tests for ``_parse_pth_package_parts`` covering the
-quote-stripping, whitespace, empty-token, and no-match paths that the
-two real .pth fixture lines don't reach.
----
- tests/brain/test_dataclasses.py | 18 ++++++++++++------
- tests/test_manager.py           | 20 ++++++++++++++++++++
- 2 files changed, 32 insertions(+), 6 deletions(-)
-
-diff --git a/tests/brain/test_dataclasses.py b/tests/brain/test_dataclasses.py
-index 4795327a41..c49c7acc6a 100644
---- a/tests/brain/test_dataclasses.py
-+++ b/tests/brain/test_dataclasses.py
-@@ -728,7 +728,8 @@ class B:
- 
- def test_kw_only_sentinel() -> None:
-     """Test that the KW_ONLY sentinel doesn't get added to the fields."""
--    node_one, node_two = astroid.extract_node("""
-+    node_one, node_two, node_three = astroid.extract_node("""
-+    import dataclasses
-     from dataclasses import dataclass, KW_ONLY
-     from dataclasses import KW_ONLY as keyword_only
- 
-@@ -745,13 +746,18 @@ class B:
-         y: str
- 
-     B.__init__  #@
-+
-+    @dataclass
-+    class C:
-+        _: dataclasses.KW_ONLY
-+        y: str
-+
-+    C.__init__  #@
-     """)
-     expected = ["self", "y"]
--    init = next(node_one.infer())
--    assert [a.name for a in init.args.args] == expected
--
--    init = next(node_two.infer())
--    assert [a.name for a in init.args.args] == expected
-+    for node in (node_one, node_two, node_three):
-+        init = next(node.infer())
-+        assert [a.name for a in init.args.args] == expected
- 
- 
- def test_kw_only_decorator() -> None:
-diff --git a/tests/test_manager.py b/tests/test_manager.py
-index 00c146cc6d..482ea206a8 100644
---- a/tests/test_manager.py
-+++ b/tests/test_manager.py
-@@ -602,3 +602,23 @@ def test_builtins_inference_after_clearing_cache_manually(self) -> None:
-         isinstance_call = astroid.extract_node("isinstance(1, int)")
-         inferred = next(isinstance_call.infer())
-         self.assertIs(inferred.value, True)
-+
-+
-+class NamespacePthParserTest(unittest.TestCase):
-+    """Direct coverage for the .pth parsing helpers used by namespace tests."""
-+
-+    def test_parse_extracts_quoted_tuple(self) -> None:
-+        line = "import sys; p = os.path.join(s, *('foogle', 'crank'))"
-+        self.assertEqual(_parse_pth_package_parts(line), ("foogle", "crank"))
-+
-+    def test_parse_handles_double_quotes_and_whitespace(self) -> None:
-+        line = '*(  "foo" ,  "bar" )'
-+        self.assertEqual(_parse_pth_package_parts(line), ("foo", "bar"))
-+
-+    def test_parse_skips_empty_tokens(self) -> None:
-+        line = "*('foo', '', 'bar',)"
-+        self.assertEqual(_parse_pth_package_parts(line), ("foo", "bar"))
-+
-+    def test_parse_returns_empty_when_no_match(self) -> None:
-+        self.assertEqual(_parse_pth_package_parts("# comment only"), ())
-+        self.assertEqual(_parse_pth_package_parts(""), ())
-
-From 1e639d06f2968a1ea1d4a7d721417107747d7424 Mon Sep 17 00:00:00 2001
-From: Pierre Sassoulas <pierre.sassoulas@gmail.com>
-Date: Sat, 16 May 2026 14:19:22 +0200
-Subject: [PATCH 12/12] test: cover trailing _is_keyword_only_sentinel return
- path
-
-Add ``test_kw_only_sentinel_other_dataclasses_attr`` to ensure that a
-field annotated with ``dataclasses.MISSING`` is not mistaken for the
-``KW_ONLY`` sentinel.
-
-On Python 3.15+, ``dataclasses.MISSING`` also infers to
-``builtins.sentinel``, so it reaches ``_is_keyword_only_sentinel`` as an
-``Attribute`` node whose ``attrname`` is not ``"KW_ONLY"`` -- exercising
-the trailing ``return False`` and locking in the user-visible behavior
-that ``MISSING`` stays a regular field.
----
- tests/brain/test_dataclasses.py | 19 +++++++++++++++++++
- 1 file changed, 19 insertions(+)
-
-diff --git a/tests/brain/test_dataclasses.py b/tests/brain/test_dataclasses.py
-index c49c7acc6a..ea8f343b87 100644
---- a/tests/brain/test_dataclasses.py
-+++ b/tests/brain/test_dataclasses.py
-@@ -760,6 +760,25 @@ class C:
-         assert [a.name for a in init.args.args] == expected
- 
- 
-+def test_kw_only_sentinel_other_dataclasses_attr() -> None:
-+    """Annotating with another ``dataclasses`` attribute (e.g. ``MISSING``)
-+    that also infers to ``builtins.sentinel`` on Python 3.15+ must not be
-+    treated as ``KW_ONLY``."""
-+    node = astroid.extract_node("""
-+    import dataclasses
-+    from dataclasses import dataclass
-+
-+    @dataclass
-+    class C:
-+        _: dataclasses.MISSING
-+        y: str
-+
-+    C.__init__  #@
-+    """)
-+    init = next(node.infer())
-+    assert [a.name for a in init.args.args] == ["self", "_", "y"]
-+
-+
- def test_kw_only_decorator() -> None:
-     """Test that we update the signature correctly based on the keyword."""
-     foodef, bardef, cee, dee = astroid.extract_node("""

diff --git a/fix-py315-is-namespace.patch b/fix-py315-is-namespace.patch
deleted file mode 100644
index d281894..0000000
--- a/fix-py315-is-namespace.patch
+++ /dev/null
@@ -1,27 +0,0 @@
-# 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/fix-python315-compatibility.patch b/fix-python315-compatibility.patch
deleted file mode 100644
index 02152c2..0000000
--- a/fix-python315-compatibility.patch
+++ /dev/null
@@ -1,142 +0,0 @@
-diff --git a/astroid/brain/brain_typing.py b/astroid/brain/brain_typing.py
-index e0eb15f..2e580e3 100644
---- a/astroid/brain/brain_typing.py
-+++ b/astroid/brain/brain_typing.py
-@@ -15,7 +15,7 @@ from typing import Final
- from astroid import context, nodes
- from astroid.brain.helpers import register_module_extender
- from astroid.builder import AstroidBuilder, _extract_single_node, extract_node
--from astroid.const import PY312_PLUS, PY313_PLUS, PY314_PLUS
-+from astroid.const import PY312_PLUS, PY313_PLUS, PY314_PLUS, PY315_PLUS
- from astroid.exceptions import (
-     AstroidSyntaxError,
-     AttributeInferenceError,
-@@ -464,6 +464,10 @@ def _typing_transform():
-         @classmethod
-         def __class_getitem__(cls, item): return cls
-     """)
-+    if PY315_PLUS:
-+        code += textwrap.dedent("""
-+    class ByteString: pass
-+    """)
-     return AstroidBuilder(AstroidManager()).string_build(code)
- 
- 
-diff --git a/astroid/const.py b/astroid/const.py
-index dcce074..e4e7978 100644
---- a/astroid/const.py
-+++ b/astroid/const.py
-@@ -10,6 +10,7 @@ PY312_PLUS = sys.version_info >= (3, 12)
- PY313 = sys.version_info[:2] == (3, 13)
- PY313_PLUS = sys.version_info >= (3, 13)
- PY314_PLUS = sys.version_info >= (3, 14)
-+PY315_PLUS = sys.version_info >= (3, 15)
- 
- WIN32 = sys.platform == "win32"
- 
-diff --git a/astroid/decorators.py b/astroid/decorators.py
-index 05d2dd3..7c63b2f 100644
---- a/astroid/decorators.py
-+++ b/astroid/decorators.py
-@@ -61,12 +61,13 @@ def yes_if_nothing_inferred(
-         generator = func(*args, **kwargs)
- 
-         try:
--            yield next(generator)
-+            first_value = next(generator)
-         except StopIteration:
-             # generator is empty
-             yield util.Uninferable
-             return
- 
-+        yield first_value
-         yield from generator
- 
-     return inner
-@@ -78,7 +79,7 @@ def raise_if_nothing_inferred(
-     def inner(*args: _P.args, **kwargs: _P.kwargs) -> Generator[InferenceResult]:
-         generator = func(*args, **kwargs)
-         try:
--            yield next(generator)
-+            first_value = next(generator)
-         except StopIteration as error:
-             # generator is empty
-             if error.args:
-@@ -91,6 +92,7 @@ def raise_if_nothing_inferred(
-                 f"RecursionError raised with limit {sys.getrecursionlimit()}."
-             ) from error
- 
-+        yield first_value
-         yield from generator
- 
-     return inner
-diff --git a/astroid/protocols.py b/astroid/protocols.py
-index 6565688..c19c761 100644
---- a/astroid/protocols.py
-+++ b/astroid/protocols.py
-@@ -545,7 +545,7 @@ ExceptionGroup
- """)))
-         assigned = objects.ExceptionInstance(eg)
-         assigned.instance_attrs["exceptions"] = [
--            nodes.List.from_elements(_generate_assigned())
-+            nodes.Tuple.from_elements(_generate_assigned())
-         ]
-         yield assigned
-     else:
-diff --git a/tests/brain/test_brain.py b/tests/brain/test_brain.py
-index 0b60ac2..2330b49 100644
---- a/tests/brain/test_brain.py
-+++ b/tests/brain/test_brain.py
-@@ -15,7 +15,7 @@ import astroid
- from astroid import MANAGER, builder, nodes, objects, test_utils, util
- from astroid.bases import Instance
- from astroid.brain.brain_namedtuple_enum import _get_namedtuple_fields
--from astroid.const import PY312_PLUS, PY313_PLUS
-+from astroid.const import PY312_PLUS, PY313_PLUS, PY315_PLUS
- from astroid.exceptions import (
-     AttributeInferenceError,
-     InferenceError,
-@@ -164,6 +164,8 @@ class TypeBrain(unittest.TestCase):
- 
- 
- def check_metaclass_is_abc(node: nodes.ClassDef):
-+    if PY315_PLUS and node.name == "ByteString":
-+        return
-     if PY312_PLUS and node.name == "ByteString":
-         # .metaclass() finds the first metaclass in the mro(),
-         # which, from 3.12, is _DeprecateByteStringMeta (unhelpful)
-diff --git a/tests/test_group_exceptions.py b/tests/test_group_exceptions.py
-index 9680664..fbdb020 100644
---- a/tests/test_group_exceptions.py
-+++ b/tests/test_group_exceptions.py
-@@ -126,12 +126,12 @@ def test_star_exceptions_infer_exceptions() -> None:
-     assert isinstance(node, nodes.TryStar)
-     inferred_ve = next(node.handlers[0].statement().name.infer())
-     assert inferred_ve.name == "ExceptionGroup"
--    assert isinstance(inferred_ve.getattr("exceptions")[0], nodes.List)
-+    assert isinstance(inferred_ve.getattr("exceptions")[0], nodes.Tuple)
-     assert (
-         inferred_ve.getattr("exceptions")[0].elts[0].pytype() == "builtins.ValueError"
-     )
- 
-     inferred_te = next(node.handlers[1].statement().name.infer())
-     assert inferred_te.name == "ExceptionGroup"
--    assert isinstance(inferred_te.getattr("exceptions")[0], nodes.List)
-+    assert isinstance(inferred_te.getattr("exceptions")[0], nodes.Tuple)
-     assert inferred_te.getattr("exceptions")[0].elts[0].pytype() == "builtins.TypeError"
-diff --git a/tests/test_regrtest.py b/tests/test_regrtest.py
-index a207057..e2b9916 100644
---- a/tests/test_regrtest.py
-+++ b/tests/test_regrtest.py
-@@ -535,7 +535,10 @@ def test_regression_parse_deeply_nested_parentheses() -> None:
-         extract_node(
-             "A=((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((c,j=t"
-         )
-+    # Python 3.15+ returns SyntaxError for deeply nested parentheses
-+    # PyPy returns SyntaxError
-+    # Python <3.15 CPython returns MemoryError
-     expected = (
--        SyntaxError if platform.python_implementation() == "PyPy" else MemoryError
-+        SyntaxError if (platform.python_implementation() == "PyPy" or sys.version_info >= (3, 15)) else MemoryError
-     )
-     assert isinstance(ctx.value.error, expected)

diff --git a/python-astroid.spec b/python-astroid.spec
index 1a38d8e..d840c4d 100644
--- a/python-astroid.spec
+++ b/python-astroid.spec
@@ -1,6 +1,6 @@
 %global srcname     astroid
 
-Version:        4.1.2
+Version:        4.3.1
 
 Name:           python-astroid
 # Note: please check that this doesn't break pylint before committing and building! -GC
@@ -10,14 +10,6 @@ License:        LGPL-2.1-or-later
 URL:            https://pypi.org/project/astroid/
 Source0:        https://github.com/pylint-dev/%{srcname}/archive/v%{version}/%{srcname}-%{version}.tar.gz
 
-# Fix compatibility with Python 3.15
-# https://github.com/pylint-dev/astroid/issues/3032
-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
 # Fix test_ssl with openssl 4
 Patch:          3161.patch
 BuildArch:      noarch

diff --git a/sources b/sources
index 2cf117c..9e4fb49 100644
--- a/sources
+++ b/sources
@@ -1 +1 @@
-SHA512 (astroid-4.1.2.tar.gz) = c3df42dd8d9cc3c74bd49e416df1f425e6c052b947a223393edfc2f83ad7e73b848f8cc8ec5a3af4adb47dd6bb2baa456c4f450685d55a2e45d5c5a5663d9839
+SHA512 (astroid-4.3.1.tar.gz) = 14f2e9502022b00356d3e5eded157e5fd758ff6fbed746780e920a844547b8fd84c2583a5bdaa53dd4c6cb46806344a30b58f56fdbd90748ef2932eec1de495e

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

only message in thread, other threads:[~2026-08-17 20:14 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-08-17 20:14 [rpms/python-astroid] rawhide: 4.3.1 Gwyn Ciesla

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