Script 'mail_helper' called by obssrc Hello community, here is the log from the commit of package python-astroid for openSUSE:Factory checked in at 2023-07-19 19:09:38 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/python-astroid (Old) and /work/SRC/openSUSE:Factory/.python-astroid.new.5570 (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "python-astroid" Wed Jul 19 19:09:38 2023 rev:47 rq:1098939 version:2.15.6 Changes: -------- --- /work/SRC/openSUSE:Factory/python-astroid/python-astroid.changes 2023-05-16 14:27:10.543655961 +0200 +++ /work/SRC/openSUSE:Factory/.python-astroid.new.5570/python-astroid.changes 2023-07-19 19:09:40.752231063 +0200 @@ -1,0 +2,8 @@ +Sun Jul 16 11:40:36 UTC 2023 - Dirk Müller <dmuel...@suse.com> + +- update to 2.15.6: + * Harden ``get_module_part()`` against ``"."``. + * Avoid expensive list/tuple multiplication operations that + would result in ``MemoryError``. + +------------------------------------------------------------------- Old: ---- astroid-2.15.5-gh.tar.gz New: ---- astroid-2.15.6-gh.tar.gz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ python-astroid.spec ++++++ --- /var/tmp/diff_new_pack.emZBtx/_old 2023-07-19 19:09:42.244239790 +0200 +++ /var/tmp/diff_new_pack.emZBtx/_new 2023-07-19 19:09:42.288240047 +0200 @@ -18,7 +18,7 @@ %{?sle15_python_module_pythons} Name: python-astroid -Version: 2.15.5 +Version: 2.15.6 Release: 0 Summary: Representation of Python source as an AST for pylint License: LGPL-2.1-or-later ++++++ astroid-2.15.5-gh.tar.gz -> astroid-2.15.6-gh.tar.gz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/astroid-2.15.5/ChangeLog new/astroid-2.15.6/ChangeLog --- old/astroid-2.15.5/ChangeLog 2023-05-14 19:31:36.000000000 +0200 +++ new/astroid-2.15.6/ChangeLog 2023-07-08 20:25:56.000000000 +0200 @@ -7,13 +7,30 @@ Release date: TBA +* Fix a regression in 2.12.0 where settings in AstroidManager would be ignored. + Most notably this addresses pylint-dev/pylint#7433. -What's New in astroid 2.15.6? + Refs #2204 + +What's New in astroid 2.15.7? ============================= Release date: TBA +What's New in astroid 2.15.6? +============================= +Release date: 2023-07-08 + +* Harden ``get_module_part()`` against ``"."``. + + Closes pylint-dev/pylint#8749 + +* Avoid expensive list/tuple multiplication operations that would result in ``MemoryError``. + + Closes pylint-dev/pylint#8748 + + What's New in astroid 2.15.5? ============================= Release date: 2023-05-14 diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/astroid-2.15.5/astroid/__pkginfo__.py new/astroid-2.15.6/astroid/__pkginfo__.py --- old/astroid-2.15.5/astroid/__pkginfo__.py 2023-05-14 19:31:36.000000000 +0200 +++ new/astroid-2.15.6/astroid/__pkginfo__.py 2023-07-08 20:25:56.000000000 +0200 @@ -2,5 +2,5 @@ # For details: https://github.com/PyCQA/astroid/blob/main/LICENSE # Copyright (c) https://github.com/PyCQA/astroid/blob/main/CONTRIBUTORS.txt -__version__ = "2.15.5" +__version__ = "2.15.6" version = __version__ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/astroid-2.15.5/astroid/manager.py new/astroid-2.15.6/astroid/manager.py --- old/astroid-2.15.5/astroid/manager.py 2023-05-14 19:31:36.000000000 +0200 +++ new/astroid-2.15.6/astroid/manager.py 2023-07-08 20:25:56.000000000 +0200 @@ -70,14 +70,28 @@ self.astroid_cache = AstroidManager.brain["astroid_cache"] self._mod_file_cache = AstroidManager.brain["_mod_file_cache"] self._failed_import_hooks = AstroidManager.brain["_failed_import_hooks"] - self.always_load_extensions = AstroidManager.brain["always_load_extensions"] - self.optimize_ast = AstroidManager.brain["optimize_ast"] self.extension_package_whitelist = AstroidManager.brain[ "extension_package_whitelist" ] self._transform = AstroidManager.brain["_transform"] @property + def always_load_extensions(self) -> bool: + return AstroidManager.brain["always_load_extensions"] + + @always_load_extensions.setter + def always_load_extensions(self, value: bool) -> None: + AstroidManager.brain["always_load_extensions"] = value + + @property + def optimize_ast(self) -> bool: + return AstroidManager.brain["optimize_ast"] + + @optimize_ast.setter + def optimize_ast(self, value: bool) -> None: + AstroidManager.brain["optimize_ast"] = value + + @property def register_transform(self): # This and unregister_transform below are exported for convenience return self._transform.register_transform diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/astroid-2.15.5/astroid/modutils.py new/astroid-2.15.6/astroid/modutils.py --- old/astroid-2.15.5/astroid/modutils.py 2023-05-14 19:31:36.000000000 +0200 +++ new/astroid-2.15.6/astroid/modutils.py 2023-07-08 20:25:56.000000000 +0200 @@ -433,7 +433,8 @@ ), "explicit relative import, but no context_file?" path = [] # prevent resolving the import non-relatively starti = 1 - while parts[starti] == "": # for all further dots: change context + # for all further dots: change context + while starti < len(parts) and parts[starti] == "": starti += 1 assert ( context_file is not None diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/astroid-2.15.5/astroid/protocols.py new/astroid-2.15.6/astroid/protocols.py --- old/astroid-2.15.5/astroid/protocols.py 2023-05-14 19:31:36.000000000 +0200 +++ new/astroid-2.15.6/astroid/protocols.py 2023-07-08 20:25:56.000000000 +0200 @@ -167,16 +167,19 @@ def _multiply_seq_by_int( self: _TupleListNodeT, opnode: nodes.AugAssign | nodes.BinOp, - other: nodes.Const, + value: int, context: InferenceContext, ) -> _TupleListNodeT: node = self.__class__(parent=opnode) + if value > 1e8: + node.elts = [util.Uninferable] + return node filtered_elts = ( helpers.safe_infer(elt, context) or util.Uninferable for elt in self.elts if not isinstance(elt, util.UninferableBase) ) - node.elts = list(filtered_elts) * other.value + node.elts = list(filtered_elts) * value return node @@ -225,14 +228,17 @@ if not isinstance(other.value, int): yield not_implemented return - yield _multiply_seq_by_int(self, opnode, other, context) + yield _multiply_seq_by_int(self, opnode, other.value, context) elif isinstance(other, bases.Instance) and operator == "*": # Verify if the instance supports __index__. as_index = helpers.class_instance_as_index(other) if not as_index: yield util.Uninferable + elif not isinstance(as_index.value, int): # pragma: no cover + # already checked by class_instance_as_index() but faster than casting + raise AssertionError("Please open a bug report.") else: - yield _multiply_seq_by_int(self, opnode, as_index, context) + yield _multiply_seq_by_int(self, opnode, as_index.value, context) else: yield not_implemented diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/astroid-2.15.5/tbump.toml new/astroid-2.15.6/tbump.toml --- old/astroid-2.15.5/tbump.toml 2023-05-14 19:31:36.000000000 +0200 +++ new/astroid-2.15.6/tbump.toml 2023-07-08 20:25:56.000000000 +0200 @@ -1,7 +1,7 @@ github_url = "https://github.com/PyCQA/astroid" [version] -current = "2.15.5" +current = "2.15.6" regex = ''' ^(?P<major>0|[1-9]\d*) \. diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/astroid-2.15.5/tests/test_modutils.py new/astroid-2.15.6/tests/test_modutils.py --- old/astroid-2.15.5/tests/test_modutils.py 2023-05-14 19:31:36.000000000 +0200 +++ new/astroid-2.15.6/tests/test_modutils.py 2023-07-08 20:25:56.000000000 +0200 @@ -147,6 +147,9 @@ ImportError, modutils.get_module_part, "unknown.module", modutils.__file__ ) + def test_get_module_part_only_dot(self) -> None: + self.assertEqual(modutils.get_module_part(".", modutils.__file__), ".") + class ModPathFromFileTest(unittest.TestCase): """Given an absolute file path return the python module's path as a list.""" diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/astroid-2.15.5/tests/test_protocols.py new/astroid-2.15.6/tests/test_protocols.py --- old/astroid-2.15.5/tests/test_protocols.py 2023-05-14 19:31:36.000000000 +0200 +++ new/astroid-2.15.6/tests/test_protocols.py 2023-07-08 20:25:56.000000000 +0200 @@ -279,6 +279,13 @@ parsed = extract_node("None ** 2") assert parsed.inferred() == [Uninferable] + @staticmethod + def test_uninferable_list_multiplication() -> None: + """Attempting to calculate the result is prohibitively expensive.""" + parsed = extract_node("[0] * 123456789") + element = parsed.inferred()[0].elts[0] + assert element.value is Uninferable + @pytest.mark.skipif(not PY38_PLUS, reason="needs assignment expressions") def test_named_expr_inference() -> None: diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/astroid-2.15.5/tests/test_regrtest.py new/astroid-2.15.6/tests/test_regrtest.py --- old/astroid-2.15.5/tests/test_regrtest.py 2023-05-14 19:31:36.000000000 +0200 +++ new/astroid-2.15.6/tests/test_regrtest.py 2023-07-08 20:25:56.000000000 +0200 @@ -9,7 +9,7 @@ import pytest -from astroid import MANAGER, Instance, bases, nodes, parse, test_utils +from astroid import MANAGER, Instance, bases, manager, nodes, parse, test_utils from astroid.builder import AstroidBuilder, _extract_single_node, extract_node from astroid.const import PY38_PLUS from astroid.context import InferenceContext @@ -37,6 +37,24 @@ sys.path.pop(0) sys.path_importer_cache.pop(resources.find("data"), None) + def test_manager_instance_attributes_reference_global_MANAGER(self) -> None: + for expected in (True, False): + with mock.patch.dict( + manager.AstroidManager.brain, + values={"always_load_extensions": expected}, + ): + assert ( + MANAGER.always_load_extensions + == manager.AstroidManager.brain["always_load_extensions"] + ) + with mock.patch.dict( + manager.AstroidManager.brain, + values={"optimize_ast": expected}, + ): + assert ( + MANAGER.optimize_ast == manager.AstroidManager.brain["optimize_ast"] + ) + def test_module_path(self) -> None: man = test_utils.brainless_manager() mod = man.ast_from_module_name("package.import_package_subpackage_module") @@ -50,9 +68,9 @@ self.assertEqual(module.name, "package.subpackage.module") def test_package_sidepackage(self) -> None: - manager = test_utils.brainless_manager() + brainless_manager = test_utils.brainless_manager() assert "package.sidepackage" not in MANAGER.astroid_cache - package = manager.ast_from_module_name("absimp") + package = brainless_manager.ast_from_module_name("absimp") self.assertIsInstance(package, nodes.Module) self.assertTrue(package.package) subpackage = next(package.getattr("sidepackage")[0].infer())