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 2022-12-04 14:57:43 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/python-astroid (Old) and /work/SRC/openSUSE:Factory/.python-astroid.new.1835 (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "python-astroid" Sun Dec 4 14:57:43 2022 rev:40 rq:1039738 version:2.12.13 Changes: -------- --- /work/SRC/openSUSE:Factory/python-astroid/python-astroid.changes 2022-10-30 18:28:30.294277051 +0100 +++ /work/SRC/openSUSE:Factory/.python-astroid.new.1835/python-astroid.changes 2022-12-04 14:57:53.320109290 +0100 @@ -1,0 +2,17 @@ +Sat Dec 3 03:46:28 UTC 2022 - Yogalakshmi Arunachalam <yarunacha...@suse.com> + +- Update to 2.12.13: + * Prevent returning an empty list for ``ClassDef.slots()`` when the mro list contains one class & it is not ``object``. + Refs PyCQA/pylint#5099 + + * Prevent a crash when inferring calls to ``str.format`` with inferred arguments + that would be invalid. + Closes #1856 + + * Infer the `length` argument of the ``random.sample`` function. + Refs PyCQA/pylint#7706 + + * Catch ``ValueError`` when indexing some builtin containers and sequences during inference. + Closes #1843 + +------------------------------------------------------------------- Old: ---- astroid-2.12.12-gh.tar.gz New: ---- astroid-2.12.13-gh.tar.gz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ python-astroid.spec ++++++ --- /var/tmp/diff_new_pack.pK3A2h/_old 2022-12-04 14:57:54.640116895 +0100 +++ /var/tmp/diff_new_pack.pK3A2h/_new 2022-12-04 14:57:54.664117033 +0100 @@ -17,7 +17,7 @@ Name: python-astroid -Version: 2.12.12 +Version: 2.12.13 Release: 0 Summary: Representation of Python source as an AST for pylint License: LGPL-2.1-or-later ++++++ astroid-2.12.12-gh.tar.gz -> astroid-2.12.13-gh.tar.gz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/astroid-2.12.12/.github/workflows/ci.yaml new/astroid-2.12.13/.github/workflows/ci.yaml --- old/astroid-2.12.12/.github/workflows/ci.yaml 2022-10-19 10:44:58.000000000 +0200 +++ new/astroid-2.12.13/.github/workflows/ci.yaml 2022-11-19 15:50:34.000000000 +0100 @@ -8,7 +8,8 @@ pull_request: ~ env: - CACHE_VERSION: 6 + CACHE_VERSION: 1 + KEY_PREFIX: venv DEFAULT_PYTHON: "3.10" PRE_COMMIT_CACHE: ~/.cache/pre-commit @@ -25,12 +26,14 @@ uses: actions/setup-python@v4.0.0 with: python-version: ${{ env.DEFAULT_PYTHON }} + check-latest: true - name: Generate partial Python venv restore key id: generate-python-key run: >- - echo "::set-output name=key::base-venv-${{ env.CACHE_VERSION }}-${{ - hashFiles('setup.cfg', 'requirements_test.txt', 'requirements_test_min.txt', - 'requirements_test_brain.txt', 'requirements_test_pre_commit.txt') }}" + echo "key=base-venv-${{ env.CACHE_VERSION }}-${{ + hashFiles('pyproject.toml', 'requirements_test.txt', + 'requirements_test_min.txt', 'requirements_test_brain.txt', + 'requirements_test_pre_commit.txt') }}" >> $GITHUB_OUTPUT - name: Restore Python virtual environment id: cache-venv uses: actions/cache@v3.0.4 @@ -39,8 +42,6 @@ key: >- ${{ runner.os }}-${{ steps.python.outputs.python-version }}-${{ steps.generate-python-key.outputs.key }} - restore-keys: | - ${{ runner.os }}-${{ steps.python.outputs.python-version }}-base-venv-${{ env.CACHE_VERSION }}- - name: Create Python virtual environment if: steps.cache-venv.outputs.cache-hit != 'true' run: | @@ -61,8 +62,6 @@ path: ${{ env.PRE_COMMIT_CACHE }} key: >- ${{ runner.os }}-${{ steps.generate-pre-commit-key.outputs.key }} - restore-keys: | - ${{ runner.os }}-pre-commit-${{ env.CACHE_VERSION }}- - name: Install pre-commit dependencies if: steps.cache-precommit.outputs.cache-hit != 'true' run: | @@ -92,6 +91,7 @@ uses: actions/setup-python@v4.0.0 with: python-version: ${{ matrix.python-version }} + check-latest: true - name: Install Qt if: ${{ matrix.python-version == '3.10' }} run: | @@ -99,9 +99,10 @@ - name: Generate partial Python venv restore key id: generate-python-key run: >- - echo "::set-output name=key::venv-${{ env.CACHE_VERSION }}-${{ - hashFiles('setup.cfg', 'requirements_test.txt', 'requirements_test_min.txt', - 'requirements_test_brain.txt') }}" + echo "key=${{ env.KEY_PREFIX }}-${{ env.CACHE_VERSION }}-${{ + hashFiles('pyproject.toml', 'requirements_test.txt', + 'requirements_test_min.txt', 'requirements_test_brain.txt') }}" >> + $GITHUB_OUTPUT - name: Restore Python virtual environment id: cache-venv uses: actions/cache@v3.0.4 @@ -110,8 +111,6 @@ key: >- ${{ runner.os }}-${{ steps.python.outputs.python-version }}-${{ steps.generate-python-key.outputs.key }} - restore-keys: | - ${{ runner.os }}-${{ steps.python.outputs.python-version }}-venv-${{ env.CACHE_VERSION }}- - name: Create Python virtual environment if: steps.cache-venv.outputs.cache-hit != 'true' run: | @@ -148,6 +147,7 @@ uses: actions/setup-python@v4.0.0 with: python-version: ${{ matrix.python-version }} + check-latest: true - name: Restore Python virtual environment id: cache-venv uses: actions/cache@v3.0.4 @@ -196,12 +196,13 @@ uses: actions/setup-python@v4.0.0 with: python-version: ${{ matrix.python-version }} + check-latest: true - name: Generate partial Python venv restore key id: generate-python-key run: >- - echo "::set-output name=key::venv-${{ env.CACHE_VERSION }}-${{ - hashFiles('setup.cfg', 'requirements_test_min.txt', - 'requirements_test_brain.txt') }}" + echo "key=${{ env.KEY_PREFIX }}-${{ env.CACHE_VERSION }}-${{ + hashFiles('pyproject.toml', 'requirements_test_min.txt', + 'requirements_test_brain.txt') }}" >> $env:GITHUB_OUTPUT - name: Restore Python virtual environment id: cache-venv uses: actions/cache@v3.0.4 @@ -210,8 +211,6 @@ key: >- ${{ runner.os }}-${{ steps.python.outputs.python-version }}-${{ steps.generate-python-key.outputs.key }} - restore-keys: | - ${{ runner.os }}-${{ steps.python.outputs.python-version }}-venv-${{ env.CACHE_VERSION }}- - name: Create Python virtual environment if: steps.cache-venv.outputs.cache-hit != 'true' run: | @@ -241,11 +240,13 @@ uses: actions/setup-python@v4.0.0 with: python-version: ${{ matrix.python-version }} + check-latest: true - name: Generate partial Python venv restore key id: generate-python-key run: >- - echo "::set-output name=key::venv-${{ env.CACHE_VERSION }}-${{ - hashFiles('setup.cfg', 'requirements_test_min.txt') }}" + echo "key=${{ env.KEY_PREFIX }}-${{ env.CACHE_VERSION }}-${{ + hashFiles('pyproject.toml', 'requirements_test_min.txt') + }}" >> $GITHUB_OUTPUT - name: Restore Python virtual environment id: cache-venv uses: actions/cache@v3.0.4 @@ -254,8 +255,6 @@ key: >- ${{ runner.os }}-${{ matrix.python-version }}-${{ steps.generate-python-key.outputs.key }} - restore-keys: | - ${{ runner.os }}-${{ matrix.python-version }}-venv-${{ env.CACHE_VERSION }}- - name: Create Python virtual environment if: steps.cache-venv.outputs.cache-hit != 'true' run: | diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/astroid-2.12.12/.github/workflows/release-tests.yml new/astroid-2.12.13/.github/workflows/release-tests.yml --- old/astroid-2.12.12/.github/workflows/release-tests.yml 2022-10-19 10:44:58.000000000 +0200 +++ new/astroid-2.12.13/.github/workflows/release-tests.yml 2022-11-19 15:50:34.000000000 +0100 @@ -2,9 +2,6 @@ on: workflow_dispatch -env: - DEFAULT_PYTHON: "3.10" - permissions: contents: read @@ -16,8 +13,8 @@ timeout-minutes: 5 steps: - name: Check out code from GitHub - uses: actions/checkout@v3.0.2 - - name: Set up Python + uses: actions/checkout@v3.1.0 + - name: Set up Python 3.9 id: python uses: actions/setup-python@v4.0.0 with: diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/astroid-2.12.12/.github/workflows/release.yml new/astroid-2.12.13/.github/workflows/release.yml --- old/astroid-2.12.12/.github/workflows/release.yml 2022-10-19 10:44:58.000000000 +0200 +++ new/astroid-2.12.13/.github/workflows/release.yml 2022-11-19 15:50:34.000000000 +0100 @@ -15,6 +15,9 @@ release-pypi: name: Upload release to PyPI runs-on: ubuntu-latest + environment: + name: PyPI + url: https://pypi.org/project/astroid/ steps: - name: Check out code from Github uses: actions/checkout@v3.0.2 @@ -23,6 +26,7 @@ uses: actions/setup-python@v4.0.0 with: python-version: ${{ env.DEFAULT_PYTHON }} + check-latest: true - name: Install requirements run: | # Remove dist, build, and astroid.egg-info diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/astroid-2.12.12/ChangeLog new/astroid-2.12.13/ChangeLog --- old/astroid-2.12.12/ChangeLog 2022-10-19 10:44:58.000000000 +0200 +++ new/astroid-2.12.13/ChangeLog 2022-11-19 15:50:34.000000000 +0100 @@ -7,20 +7,32 @@ Release date: TBA -* Add ``_value2member_map_`` member to the ``enum`` brain. - Refs PyCQA/pylint#3941 + +What's New in astroid 2.12.13? +============================== +Release date: 2022-11-19 * Improve detection of namespace packages for the modules with ``__spec__`` set to None. Closes PyCQA/pylint#7488. +* Prevent returning an empty list for ``ClassDef.slots()`` when the mro list contains one class & it is not ``object``. -What's New in astroid 2.12.13? -============================== -Release date: TBA + Refs PyCQA/pylint#5099 +* Prevent a crash when inferring calls to ``str.format`` with inferred arguments + that would be invalid. + Closes #1856 + +* Infer the `length` argument of the ``random.sample`` function. + + Refs PyCQA/pylint#7706 + +* Catch ``ValueError`` when indexing some builtin containers and sequences during inference. + + Closes #1843 What's New in astroid 2.12.12? ============================== @@ -44,6 +56,10 @@ ============================== Release date: 2022-10-10 +* Add ``_value2member_map_`` member to the ``enum`` brain. + + Refs PyCQA/pylint#3941 + * Improve detection of namespace packages for the modules with ``__spec__`` set to None. Closes PyCQA/pylint#7488. diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/astroid-2.12.12/astroid/__pkginfo__.py new/astroid-2.12.13/astroid/__pkginfo__.py --- old/astroid-2.12.12/astroid/__pkginfo__.py 2022-10-19 10:44:58.000000000 +0200 +++ new/astroid-2.12.13/astroid/__pkginfo__.py 2022-11-19 15:50:34.000000000 +0100 @@ -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.12.12" +__version__ = "2.12.13" version = __version__ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/astroid-2.12.12/astroid/brain/brain_builtin_inference.py new/astroid-2.12.13/astroid/brain/brain_builtin_inference.py --- old/astroid-2.12.12/astroid/brain/brain_builtin_inference.py 2022-10-19 10:44:58.000000000 +0200 +++ new/astroid-2.12.13/astroid/brain/brain_builtin_inference.py 2022-11-19 15:50:34.000000000 +0100 @@ -954,8 +954,10 @@ try: formatted_string = format_template.format(*pos_values, **keyword_values) - except (IndexError, KeyError): - # If there is an IndexError there are too few arguments to interpolate + except (IndexError, KeyError, TypeError, ValueError): + # IndexError: there are too few arguments to interpolate + # TypeError: Unsupported format string + # ValueError: Unknown format code return iter([util.Uninferable]) return iter([nodes.const_factory(formatted_string)]) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/astroid-2.12.12/astroid/brain/brain_random.py new/astroid-2.12.13/astroid/brain/brain_random.py --- old/astroid-2.12.12/astroid/brain/brain_random.py 2022-10-19 10:44:58.000000000 +0200 +++ new/astroid-2.12.13/astroid/brain/brain_random.py 2022-11-19 15:50:34.000000000 +0100 @@ -42,10 +42,10 @@ if len(node.args) != 2: raise UseInferenceDefault - length = node.args[1] - if not isinstance(length, Const): + inferred_length = helpers.safe_infer(node.args[1], context=context) + if not isinstance(inferred_length, Const): raise UseInferenceDefault - if not isinstance(length.value, int): + if not isinstance(inferred_length.value, int): raise UseInferenceDefault inferred_sequence = helpers.safe_infer(node.args[0], context=context) @@ -55,12 +55,12 @@ if not isinstance(inferred_sequence, ACCEPTED_ITERABLES_FOR_SAMPLE): raise UseInferenceDefault - if length.value > len(inferred_sequence.elts): + if inferred_length.value > len(inferred_sequence.elts): # In this case, this will raise a ValueError raise UseInferenceDefault try: - elts = random.sample(inferred_sequence.elts, length.value) + elts = random.sample(inferred_sequence.elts, inferred_length.value) except ValueError as exc: raise UseInferenceDefault from exc diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/astroid-2.12.12/astroid/inference.py new/astroid-2.12.13/astroid/inference.py --- old/astroid-2.12.12/astroid/inference.py 2022-10-19 10:44:58.000000000 +0200 +++ new/astroid-2.12.13/astroid/inference.py 2022-11-19 15:50:34.000000000 +0100 @@ -26,6 +26,7 @@ AstroidError, AstroidIndexError, AstroidTypeError, + AstroidValueError, AttributeInferenceError, InferenceError, NameInferenceError, @@ -431,6 +432,7 @@ except ( AstroidTypeError, AstroidIndexError, + AstroidValueError, AttributeInferenceError, AttributeError, ) as exc: diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/astroid-2.12.12/astroid/nodes/node_classes.py new/astroid-2.12.13/astroid/nodes/node_classes.py --- old/astroid-2.12.12/astroid/nodes/node_classes.py 2022-10-19 10:44:58.000000000 +0200 +++ new/astroid-2.12.13/astroid/nodes/node_classes.py 2022-11-19 15:50:34.000000000 +0100 @@ -22,6 +22,7 @@ from astroid.exceptions import ( AstroidIndexError, AstroidTypeError, + AstroidValueError, InferenceError, NoDefault, ParentMissingError, @@ -234,6 +235,13 @@ return new_cls if isinstance(index, Const): return elts[index.value] + except ValueError as exc: + raise AstroidValueError( + message="Slice {index!r} cannot index container", + node=instance, + index=index, + context=context, + ) from exc except IndexError as exc: raise AstroidIndexError( message="Index {index!s} out of range", @@ -2030,6 +2038,10 @@ try: if isinstance(self.value, (str, bytes)): return Const(self.value[index_value]) + except ValueError as exc: + raise AstroidValueError( + f"Could not index {self.value!r} with {index_value!r}" + ) from exc except IndexError as exc: raise AstroidIndexError( message="Index {index!r} out of range", diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/astroid-2.12.12/astroid/nodes/scoped_nodes/scoped_nodes.py new/astroid-2.12.13/astroid/nodes/scoped_nodes/scoped_nodes.py --- old/astroid-2.12.12/astroid/nodes/scoped_nodes/scoped_nodes.py 2022-10-19 10:44:58.000000000 +0200 +++ new/astroid-2.12.13/astroid/nodes/scoped_nodes/scoped_nodes.py 2022-11-19 15:50:34.000000000 +0100 @@ -2959,8 +2959,10 @@ def grouped_slots( mro: list[ClassDef], ) -> Iterator[node_classes.NodeNG | None]: - # Not interested in object, since it can't have slots. - for cls in mro[:-1]: + for cls in mro: + # Not interested in object, since it can't have slots. + if cls.qname() == "builtins.object": + continue try: cls_slots = cls._slots() except NotImplementedError: diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/astroid-2.12.12/script/create_contributor_list.py new/astroid-2.12.13/script/create_contributor_list.py --- old/astroid-2.12.12/script/create_contributor_list.py 2022-10-19 10:44:58.000000000 +0200 +++ new/astroid-2.12.13/script/create_contributor_list.py 2022-11-19 15:50:34.000000000 +0100 @@ -6,9 +6,14 @@ from contributors_txt import create_contributors_txt -ASTROID_BASE_DIRECTORY = Path(__file__).parent.parent -ALIASES_FILE = ASTROID_BASE_DIRECTORY / "script/.contributors_aliases.json" -DEFAULT_CONTRIBUTOR_PATH = ASTROID_BASE_DIRECTORY / "CONTRIBUTORS.txt" +CWD = Path(".").absolute() +ASTROID_BASE_DIRECTORY = Path(__file__).parent.parent.absolute() +ALIASES_FILE = ( + ASTROID_BASE_DIRECTORY / "script/.contributors_aliases.json" +).relative_to(CWD) +DEFAULT_CONTRIBUTOR_PATH = (ASTROID_BASE_DIRECTORY / "CONTRIBUTORS.txt").relative_to( + CWD +) def main(): diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/astroid-2.12.12/tbump.toml new/astroid-2.12.13/tbump.toml --- old/astroid-2.12.12/tbump.toml 2022-10-19 10:44:58.000000000 +0200 +++ new/astroid-2.12.13/tbump.toml 2022-11-19 15:50:34.000000000 +0100 @@ -1,7 +1,7 @@ github_url = "https://github.com/PyCQA/astroid" [version] -current = "2.12.12" +current = "2.12.13" regex = ''' ^(?P<major>0|[1-9]\d*) \. @@ -40,6 +40,10 @@ name = "Apply pre-commit" cmd = "pre-commit run --all-files||echo 'Hack so this command does not fail'" +[[before_commit]] +name = "Confirm changes" +cmd = "read -p 'Continue (y)? ' -n 1 -r; echo; [[ ! $REPLY =~ ^[Yy]$ ]] && exit 1 || exit 0" + # Or run some commands after the git tag and the branch # have been pushed: # [[after_push]] diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/astroid-2.12.12/tests/unittest_brain.py new/astroid-2.12.13/tests/unittest_brain.py --- old/astroid-2.12.12/tests/unittest_brain.py 2022-10-19 10:44:58.000000000 +0200 +++ new/astroid-2.12.13/tests/unittest_brain.py 2022-11-19 15:50:34.000000000 +0100 @@ -1819,6 +1819,26 @@ assert isinstance(slots[0], nodes.Const) assert slots[0].value == "value" + def test_collections_generic_alias_slots(self): + """Test slots for a class which is a subclass of a generic alias type.""" + node = builder.extract_node( + """ + import collections + import typing + Type = typing.TypeVar('Type') + class A(collections.abc.AsyncIterator[Type]): + __slots__ = ('_value',) + def __init__(self, value: collections.abc.AsyncIterator[Type]): + self._value = value + """ + ) + inferred = next(node.infer()) + assert isinstance(inferred, nodes.ClassDef) + slots = inferred.slots() + assert len(slots) == 1 + assert isinstance(slots[0], nodes.Const) + assert slots[0].value == "_value" + def test_has_dunder_args(self) -> None: ast_node = builder.extract_node( """ @@ -2391,6 +2411,29 @@ inferred = next(node.infer()) self.assertIsInstance(inferred, astroid.List) elems = sorted(elem.value for elem in inferred.elts) + self.assertEqual(elems, [1, 2]) + + def test_arguments_inferred_successfully(self) -> None: + """Test inference of `random.sample` when both arguments are of type `nodes.Call`.""" + node = astroid.extract_node( + """ + import random + + def sequence(): + return [1, 2] + + random.sample(sequence(), len([1,2])) #@ + """ + ) + # Check that arguments are of type `nodes.Call`. + sequence, length = node.args + self.assertIsInstance(sequence, astroid.Call) + self.assertIsInstance(length, astroid.Call) + + # Check the inference of `random.sample` call. + inferred = next(node.infer()) + self.assertIsInstance(inferred, astroid.List) + elems = sorted(elem.value for elem in inferred.elts) self.assertEqual(elems, [1, 2]) def test_no_crash_on_evaluatedobject(self) -> None: diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/astroid-2.12.12/tests/unittest_brain_builtin.py new/astroid-2.12.13/tests/unittest_brain_builtin.py --- old/astroid-2.12.12/tests/unittest_brain_builtin.py 2022-10-19 10:44:58.000000000 +0200 +++ new/astroid-2.12.13/tests/unittest_brain_builtin.py 2022-11-19 15:50:34.000000000 +0100 @@ -103,6 +103,12 @@ """ "My name is {fname}, I'm {age}".format(fsname = "Daniel", age = 12) """, + """ + "My unicode character is {:c}".format(None) + """, + """ + "My hex format is {:4x}".format('1') + """, ], ) def test_string_format_uninferable(self, format_string: str) -> None: diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/astroid-2.12.12/tests/unittest_inference.py new/astroid-2.12.13/tests/unittest_inference.py --- old/astroid-2.12.12/tests/unittest_inference.py 2022-10-19 10:44:58.000000000 +0200 +++ new/astroid-2.12.13/tests/unittest_inference.py 2022-11-19 15:50:34.000000000 +0100 @@ -5317,6 +5317,16 @@ assert inferred == util.Uninferable +def test_slice_zero_step_does_not_raise_ValueError() -> None: + node = extract_node("x = [][::0]; x") + assert next(node.infer()) == util.Uninferable + + +def test_slice_zero_step_on_str_does_not_raise_ValueError() -> None: + node = extract_node('x = ""[::0]; x') + assert next(node.infer()) == util.Uninferable + + def test_unpacking_starred_and_dicts_in_assignment() -> None: node = extract_node( """