Script 'mail_helper' called by obssrc Hello community, here is the log from the commit of package python-pylint for openSUSE:Factory checked in at 2022-09-23 14:15:17 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/python-pylint (Old) and /work/SRC/openSUSE:Factory/.python-pylint.new.2275 (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "python-pylint" Fri Sep 23 14:15:17 2022 rev:30 rq:1005486 version:2.15.3 Changes: -------- --- /work/SRC/openSUSE:Factory/python-pylint/python-pylint.changes 2022-09-13 15:11:07.116934755 +0200 +++ /work/SRC/openSUSE:Factory/.python-pylint.new.2275/python-pylint.changes 2022-09-23 14:15:52.242071774 +0200 @@ -1,0 +2,15 @@ +Thu Sep 22 12:45:04 UTC 2022 - Michael Str??der <[email protected]> + +- update to 2.15.3 + * Fixed a crash in the unhashable-member checker when using a lambda as a dict key. 7453 + * Fix a crash in the modified-iterating-dict checker involving + instance attributes. #7461 + * invalid-class-object does not crash anymore when __class__ is assigned + alongside another variable. #7467 + * Fix false positive for global-variable-not-assigned when a global + variable is re-assigned via an ImportFrom node. #4809 + * Fix false positive for undefined-loop-variable in for-else loops that + use a function having a return type annotation of NoReturn or Never. #7311 + * --help-msg now accepts a comma-separated list of message IDs again. #7471 + +------------------------------------------------------------------- Old: ---- pylint-2.15.2-gh.tar.gz New: ---- pylint-2.15.3-gh.tar.gz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ python-pylint.spec ++++++ --- /var/tmp/diff_new_pack.Ovtfnx/_old 2022-09-23 14:15:52.794073060 +0200 +++ /var/tmp/diff_new_pack.Ovtfnx/_new 2022-09-23 14:15:52.798073070 +0200 @@ -18,7 +18,7 @@ %bcond_without tests Name: python-pylint -Version: 2.15.2 +Version: 2.15.3 Release: 0 Summary: Syntax and style checker for Python code License: GPL-2.0-or-later ++++++ pylint-2.15.2-gh.tar.gz -> pylint-2.15.3-gh.tar.gz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pylint-2.15.2/.github/workflows/changelog.yml new/pylint-2.15.3/.github/workflows/changelog.yml --- old/pylint-2.15.2/.github/workflows/changelog.yml 2022-09-07 14:47:49.000000000 +0200 +++ new/pylint-2.15.3/.github/workflows/changelog.yml 2022-09-19 16:19:58.000000000 +0200 @@ -6,7 +6,7 @@ env: # Also change CACHE_VERSION in the other workflows - CACHE_VERSION: 26 + CACHE_VERSION: 27 DEFAULT_PYTHON: "3.10" jobs: diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pylint-2.15.2/.github/workflows/checks.yaml new/pylint-2.15.3/.github/workflows/checks.yaml --- old/pylint-2.15.2/.github/workflows/checks.yaml 2022-09-07 14:47:49.000000000 +0200 +++ new/pylint-2.15.3/.github/workflows/checks.yaml 2022-09-19 16:19:58.000000000 +0200 @@ -8,7 +8,7 @@ pull_request: ~ env: - CACHE_VERSION: 26 + CACHE_VERSION: 27 DEFAULT_PYTHON: "3.10" PRE_COMMIT_CACHE: ~/.cache/pre-commit diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pylint-2.15.2/.github/workflows/primer-test.yaml new/pylint-2.15.3/.github/workflows/primer-test.yaml --- old/pylint-2.15.2/.github/workflows/primer-test.yaml 2022-09-07 14:47:49.000000000 +0200 +++ new/pylint-2.15.3/.github/workflows/primer-test.yaml 2022-09-19 16:19:58.000000000 +0200 @@ -13,7 +13,7 @@ - ".github/workflows/primer-test.yaml" env: - CACHE_VERSION: 26 + CACHE_VERSION: 27 concurrency: group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pylint-2.15.2/.github/workflows/primer_comment.yaml new/pylint-2.15.3/.github/workflows/primer_comment.yaml --- old/pylint-2.15.2/.github/workflows/primer_comment.yaml 2022-09-07 14:47:49.000000000 +0200 +++ new/pylint-2.15.3/.github/workflows/primer_comment.yaml 2022-09-19 16:19:58.000000000 +0200 @@ -14,7 +14,7 @@ env: # This needs to be the SAME as in the Main and PR job - CACHE_VERSION: 26 + CACHE_VERSION: 27 permissions: contents: read diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pylint-2.15.2/.github/workflows/primer_run_main.yaml new/pylint-2.15.3/.github/workflows/primer_run_main.yaml --- old/pylint-2.15.2/.github/workflows/primer_run_main.yaml 2022-09-07 14:47:49.000000000 +0200 +++ new/pylint-2.15.3/.github/workflows/primer_run_main.yaml 2022-09-19 16:19:58.000000000 +0200 @@ -16,7 +16,7 @@ env: # This needs to be the SAME as in the PR and comment job - CACHE_VERSION: 26 + CACHE_VERSION: 27 jobs: run-primer: diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pylint-2.15.2/.github/workflows/primer_run_pr.yaml new/pylint-2.15.3/.github/workflows/primer_run_pr.yaml --- old/pylint-2.15.2/.github/workflows/primer_run_pr.yaml 2022-09-07 14:47:49.000000000 +0200 +++ new/pylint-2.15.3/.github/workflows/primer_run_pr.yaml 2022-09-19 16:19:58.000000000 +0200 @@ -25,7 +25,7 @@ env: # This needs to be the SAME as in the Main and comment job - CACHE_VERSION: 26 + CACHE_VERSION: 27 jobs: run-primer: diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pylint-2.15.2/.github/workflows/tests.yaml new/pylint-2.15.3/.github/workflows/tests.yaml --- old/pylint-2.15.2/.github/workflows/tests.yaml 2022-09-07 14:47:49.000000000 +0200 +++ new/pylint-2.15.3/.github/workflows/tests.yaml 2022-09-19 16:19:58.000000000 +0200 @@ -10,7 +10,7 @@ - doc/data/messages/** env: - CACHE_VERSION: 26 + CACHE_VERSION: 27 jobs: tests-linux: diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pylint-2.15.2/doc/whatsnew/2/2.15/index.rst new/pylint-2.15.3/doc/whatsnew/2/2.15/index.rst --- old/pylint-2.15.2/doc/whatsnew/2/2.15/index.rst 2022-09-07 14:47:49.000000000 +0200 +++ new/pylint-2.15.3/doc/whatsnew/2/2.15/index.rst 2022-09-19 16:19:58.000000000 +0200 @@ -29,6 +29,30 @@ .. towncrier release notes start +What's new in Pylint 2.15.3? +---------------------------- +Release date: 2022-09-19 + + +- Fixed a crash in the ``unhashable-member`` checker when using a ``lambda`` as a dict key. + + Closes #7453 (`#7453 <https://github.com/PyCQA/pylint/issues/7453>`_) +- Fix a crash in the ``modified-iterating-dict`` checker involving instance attributes. + + Closes #7461 (`#7461 <https://github.com/PyCQA/pylint/issues/7461>`_) +- ``invalid-class-object`` does not crash anymore when ``__class__`` is assigned alongside another variable. + + Closes #7467 (`#7467 <https://github.com/PyCQA/pylint/issues/7467>`_) +- Fix false positive for ``global-variable-not-assigned`` when a global variable is re-assigned via an ``ImportFrom`` node. + + Closes #4809 (`#4809 <https://github.com/PyCQA/pylint/issues/4809>`_) +- Fix false positive for ``undefined-loop-variable`` in ``for-else`` loops that use a function + having a return type annotation of ``NoReturn`` or ``Never``. + + Closes #7311 (`#7311 <https://github.com/PyCQA/pylint/issues/7311>`_) +- ``--help-msg`` now accepts a comma-separated list of message IDs again. + + Closes #7471 (`#7471 <https://github.com/PyCQA/pylint/issues/7471>`_) What's new in Pylint 2.15.2? ---------------------------- diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pylint-2.15.2/pylint/__pkginfo__.py new/pylint-2.15.3/pylint/__pkginfo__.py --- old/pylint-2.15.2/pylint/__pkginfo__.py 2022-09-07 14:47:49.000000000 +0200 +++ new/pylint-2.15.3/pylint/__pkginfo__.py 2022-09-19 16:19:58.000000000 +0200 @@ -9,7 +9,7 @@ from __future__ import annotations -__version__ = "2.15.2" +__version__ = "2.15.3" def get_numversion_from_version(v: str) -> tuple[int, int, int]: diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pylint-2.15.2/pylint/checkers/classes/class_checker.py new/pylint-2.15.3/pylint/checkers/classes/class_checker.py --- old/pylint-2.15.2/pylint/checkers/classes/class_checker.py 2022-09-07 14:47:49.000000000 +0200 +++ new/pylint-2.15.3/pylint/checkers/classes/class_checker.py 2022-09-19 16:19:58.000000000 +0200 @@ -1558,7 +1558,18 @@ def _check_invalid_class_object(self, node: nodes.AssignAttr) -> None: if not node.attrname == "__class__": return - inferred = safe_infer(node.parent.value) + if isinstance(node.parent, nodes.Tuple): + class_index = -1 + for i, elt in enumerate(node.parent.elts): + if hasattr(elt, "attrname") and elt.attrname == "__class__": + class_index = i + if class_index == -1: + # This should not happen because we checked that the node name + # is '__class__' earlier, but let's not be too confident here + return # pragma: no cover + inferred = safe_infer(node.parent.parent.value.elts[class_index]) + else: + inferred = safe_infer(node.parent.value) if ( isinstance(inferred, nodes.ClassDef) or inferred is astroid.Uninferable diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pylint-2.15.2/pylint/checkers/modified_iterating_checker.py new/pylint-2.15.3/pylint/checkers/modified_iterating_checker.py --- old/pylint-2.15.2/pylint/checkers/modified_iterating_checker.py 2022-09-07 14:47:49.000000000 +0200 +++ new/pylint-2.15.3/pylint/checkers/modified_iterating_checker.py 2022-09-19 16:19:58.000000000 +0200 @@ -128,7 +128,7 @@ ) def _modified_iterating_list_cond( - self, node: nodes.NodeNG, iter_obj: nodes.NodeNG + self, node: nodes.NodeNG, iter_obj: nodes.Name | nodes.Attribute ) -> bool: if not self._is_node_expr_that_calls_attribute_name(node): return False @@ -141,7 +141,7 @@ ) def _modified_iterating_dict_cond( - self, node: nodes.NodeNG, iter_obj: nodes.NodeNG + self, node: nodes.NodeNG, iter_obj: nodes.Name | nodes.Attribute ) -> bool: if not self._is_node_assigns_subscript_name(node): return False @@ -159,10 +159,14 @@ return False if infer_val != utils.safe_infer(iter_obj): return False - return node.targets[0].value.name == iter_obj.name + if isinstance(iter_obj, nodes.Attribute): + iter_obj_name = iter_obj.attrname + else: + iter_obj_name = iter_obj.name + return node.targets[0].value.name == iter_obj_name def _modified_iterating_set_cond( - self, node: nodes.NodeNG, iter_obj: nodes.NodeNG + self, node: nodes.NodeNG, iter_obj: nodes.Name | nodes.Attribute ) -> bool: if not self._is_node_expr_that_calls_attribute_name(node): return False diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pylint-2.15.2/pylint/checkers/utils.py new/pylint-2.15.3/pylint/checkers/utils.py --- old/pylint-2.15.2/pylint/checkers/utils.py 2022-09-07 14:47:49.000000000 +0200 +++ new/pylint-2.15.3/pylint/checkers/utils.py 2022-09-19 16:19:58.000000000 +0200 @@ -1942,6 +1942,8 @@ for inferred in node.infer(): if inferred is astroid.Uninferable: return True + if not hasattr(inferred, "igetattr"): + return True hash_fn = next(inferred.igetattr("__hash__")) if hash_fn.parent is inferred: return True diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pylint-2.15.2/pylint/checkers/variables.py new/pylint-2.15.3/pylint/checkers/variables.py --- old/pylint-2.15.2/pylint/checkers/variables.py 2022-09-07 14:47:49.000000000 +0200 +++ new/pylint-2.15.3/pylint/checkers/variables.py 2022-09-19 16:19:58.000000000 +0200 @@ -19,7 +19,7 @@ from typing import TYPE_CHECKING, Any, NamedTuple import astroid -from astroid import extract_node, nodes +from astroid import bases, extract_node, nodes from astroid.typing import InferenceResult from pylint.checkers import BaseChecker, utils @@ -27,7 +27,12 @@ in_type_checking_block, is_postponed_evaluation_enabled, ) -from pylint.constants import PY39_PLUS, TYPING_TYPE_CHECKS_GUARDS +from pylint.constants import ( + PY39_PLUS, + TYPING_NEVER, + TYPING_NORETURN, + TYPING_TYPE_CHECKS_GUARDS, +) from pylint.interfaces import CONTROL_FLOW, HIGH, INFERENCE, INFERENCE_FAILURE from pylint.typing import MessageDefinitionTuple @@ -1311,7 +1316,8 @@ assign_nodes = [] not_defined_locally_by_import = not any( - isinstance(local, nodes.Import) for local in locals_.get(name, ()) + isinstance(local, (nodes.Import, nodes.ImportFrom)) + for local in locals_.get(name, ()) ) if ( not utils.is_reassigned_after_current(node, name) @@ -2244,13 +2250,35 @@ if not isinstance(assign, nodes.For): self.add_message("undefined-loop-variable", args=node.name, node=node) return - if any( - isinstance( + for else_stmt in assign.orelse: + if isinstance( else_stmt, (nodes.Return, nodes.Raise, nodes.Break, nodes.Continue) - ) - for else_stmt in assign.orelse - ): - return + ): + return + # TODO: 2.16: Consider using RefactoringChecker._is_function_def_never_returning + if isinstance(else_stmt, nodes.Expr) and isinstance( + else_stmt.value, nodes.Call + ): + inferred_func = utils.safe_infer(else_stmt.value.func) + if ( + isinstance(inferred_func, nodes.FunctionDef) + and inferred_func.returns + ): + inferred_return = utils.safe_infer(inferred_func.returns) + if isinstance( + inferred_return, nodes.FunctionDef + ) and inferred_return.qname() in { + *TYPING_NORETURN, + *TYPING_NEVER, + "typing._SpecialForm", + }: + return + # typing_extensions.NoReturn returns a _SpecialForm + if ( + isinstance(inferred_return, bases.Instance) + and inferred_return.qname() == "typing._SpecialForm" + ): + return maybe_walrus = utils.get_node_first_ancestor_of_type(node, nodes.NamedExpr) if maybe_walrus: diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pylint-2.15.2/pylint/config/callback_actions.py new/pylint-2.15.3/pylint/config/callback_actions.py --- old/pylint-2.15.2/pylint/config/callback_actions.py 2022-09-07 14:47:49.000000000 +0200 +++ new/pylint-2.15.3/pylint/config/callback_actions.py 2022-09-19 16:19:58.000000000 +0200 @@ -158,7 +158,11 @@ option_string: str | None = "--help-msg", ) -> None: assert isinstance(values, (list, tuple)) - self.run.linter.msgs_store.help_message(values) + values_to_print: list[str] = [] + for msg in values: + assert isinstance(msg, str) + values_to_print += utils._check_csv(msg) + self.run.linter.msgs_store.help_message(values_to_print) sys.exit(0) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pylint-2.15.2/pylint/constants.py new/pylint-2.15.3/pylint/constants.py --- old/pylint-2.15.2/pylint/constants.py 2022-09-07 14:47:49.000000000 +0200 +++ new/pylint-2.15.3/pylint/constants.py 2022-09-19 16:19:58.000000000 +0200 @@ -155,3 +155,16 @@ PYLINT_HOME = _get_pylint_home() + +TYPING_NORETURN = frozenset( + ( + "typing.NoReturn", + "typing_extensions.NoReturn", + ) +) +TYPING_NEVER = frozenset( + ( + "typing.Never", + "typing_extensions.Never", + ) +) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pylint-2.15.2/pylint/extensions/typing.py new/pylint-2.15.3/pylint/extensions/typing.py --- old/pylint-2.15.2/pylint/extensions/typing.py 2022-09-07 14:47:49.000000000 +0200 +++ new/pylint-2.15.3/pylint/extensions/typing.py 2022-09-19 16:19:58.000000000 +0200 @@ -17,6 +17,7 @@ only_required_for_messages, safe_infer, ) +from pylint.constants import TYPING_NORETURN from pylint.interfaces import INFERENCE if TYPE_CHECKING: @@ -75,12 +76,6 @@ ALIAS_NAMES = frozenset(key.split(".")[1] for key in DEPRECATED_TYPING_ALIASES) UNION_NAMES = ("Optional", "Union") -TYPING_NORETURN = frozenset( - ( - "typing.NoReturn", - "typing_extensions.NoReturn", - ) -) class DeprecatedTypingAliasMsg(NamedTuple): diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pylint-2.15.2/pyproject.toml new/pylint-2.15.3/pyproject.toml --- old/pylint-2.15.2/pyproject.toml 2022-09-07 14:47:49.000000000 +0200 +++ new/pylint-2.15.3/pyproject.toml 2022-09-19 16:19:58.000000000 +0200 @@ -34,10 +34,11 @@ dependencies = [ "dill>=0.2", "platformdirs>=2.2.0", - # Also upgrade requirements_test_min.txt if you are bumping astroid. + # Also upgrade requirements_test_min.txt and all the CACHE_VERSION in + # github actions if you are bumping astroid. # Pinned to dev of second minor update to allow editable installs and fix primer issues, # see https://github.com/PyCQA/astroid/issues/1341 - "astroid>=2.12.9,<=2.14.0-dev0", + "astroid>=2.12.10,<=2.14.0-dev0", "isort>=4.2.5,<6", "mccabe>=0.6,<0.8", "tomli>=1.1.0;python_version<'3.11'", diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pylint-2.15.2/requirements_test_min.txt new/pylint-2.15.3/requirements_test_min.txt --- old/pylint-2.15.2/requirements_test_min.txt 2022-09-07 14:47:49.000000000 +0200 +++ new/pylint-2.15.3/requirements_test_min.txt 2022-09-19 16:19:58.000000000 +0200 @@ -1,6 +1,7 @@ -e .[testutils,spelling] # astroid dependency is also defined in pyproject.toml -astroid==2.12.9 # Pinned to a specific version for tests +# You need to increment the CACHE_VERSION in github actions too +astroid==2.12.10 # Pinned to a specific version for tests typing-extensions~=4.3 pytest~=7.1 pytest-benchmark~=3.4 diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pylint-2.15.2/tbump.toml new/pylint-2.15.3/tbump.toml --- old/pylint-2.15.2/tbump.toml 2022-09-07 14:47:49.000000000 +0200 +++ new/pylint-2.15.3/tbump.toml 2022-09-19 16:19:58.000000000 +0200 @@ -1,7 +1,7 @@ github_url = "https://github.com/PyCQA/pylint" [version] -current = "2.15.2" +current = "2.15.3" regex = ''' ^(?P<major>0|[1-9]\d*) \. diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pylint-2.15.2/tests/functional/g/globals.py new/pylint-2.15.3/tests/functional/g/globals.py --- old/pylint-2.15.2/tests/functional/g/globals.py 2022-09-07 14:47:49.000000000 +0200 +++ new/pylint-2.15.3/tests/functional/g/globals.py 2022-09-19 16:19:58.000000000 +0200 @@ -31,9 +31,15 @@ def global_with_import(): - """should only warn for global-statement""" + """should only warn for global-statement when using `Import` node""" global sys # [global-statement] - import sys # pylint: disable=import-outside-toplevel + import sys + + +def global_with_import_from(): + """should only warn for global-statement when using `ImportFrom` node""" + global namedtuple # [global-statement] + from collections import namedtuple def global_no_assign(): @@ -75,11 +81,6 @@ FUNC() -def func(): - """Overriding a global with an import should only throw a global statement error""" - global sys # [global-statement] - - import sys def override_class(): """Overriding a class should only throw a global statement error""" diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pylint-2.15.2/tests/functional/g/globals.txt new/pylint-2.15.3/tests/functional/g/globals.txt --- old/pylint-2.15.2/tests/functional/g/globals.txt 2022-09-07 14:47:49.000000000 +0200 +++ new/pylint-2.15.3/tests/functional/g/globals.txt 2022-09-19 16:19:58.000000000 +0200 @@ -5,10 +5,10 @@ undefined-variable:24:10:24:13:other:Undefined variable 'HOP':UNDEFINED global-variable-undefined:29:4:29:18:define_constant:Global variable 'SOMEVAR' undefined at the module level:UNDEFINED global-statement:35:4:35:14:global_with_import:Using the global statement:UNDEFINED -global-variable-not-assigned:41:4:41:19:global_no_assign:Using global for 'CONSTANT' but no assignment is done:UNDEFINED -global-statement:47:4:47:19:global_del:Using the global statement:UNDEFINED -global-statement:54:4:54:19:global_operator_assign:Using the global statement:UNDEFINED -global-statement:61:4:61:19:global_function_assign:Using the global statement:UNDEFINED -global-statement:71:4:71:15:override_func:Using the global statement:UNDEFINED -global-statement:80:4:80:14:func:Using the global statement:UNDEFINED -global-statement:86:4:86:16:override_class:Using the global statement:UNDEFINED +global-statement:41:4:41:21:global_with_import_from:Using the global statement:UNDEFINED +global-variable-not-assigned:47:4:47:19:global_no_assign:Using global for 'CONSTANT' but no assignment is done:UNDEFINED +global-statement:53:4:53:19:global_del:Using the global statement:UNDEFINED +global-statement:60:4:60:19:global_operator_assign:Using the global statement:UNDEFINED +global-statement:67:4:67:19:global_function_assign:Using the global statement:UNDEFINED +global-statement:77:4:77:15:override_func:Using the global statement:UNDEFINED +global-statement:87:4:87:16:override_class:Using the global statement:UNDEFINED diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pylint-2.15.2/tests/functional/i/invalid/invalid_class_object.py new/pylint-2.15.3/tests/functional/i/invalid/invalid_class_object.py --- old/pylint-2.15.2/tests/functional/i/invalid/invalid_class_object.py 2022-09-07 14:47:49.000000000 +0200 +++ new/pylint-2.15.3/tests/functional/i/invalid/invalid_class_object.py 2022-09-19 16:19:58.000000000 +0200 @@ -1,12 +1,15 @@ # pylint: disable=missing-docstring,too-few-public-methods,invalid-name from collections import defaultdict + class A: pass + class B: pass + A.__class__ = B A.__class__ = str A.__class__ = float @@ -30,3 +33,43 @@ obj = C() obj.__class__ = self.__class__ return obj + + +class AnotherClass: + ... + + +class Pylint7429Good: + """See https://github.com/PyCQA/pylint/issues/7467""" + + def class_defining_function_good(self): + self.__class__, myvar = AnotherClass, "myvalue" + print(myvar) + + def class_defining_function_bad(self): + self.__class__, myvar = 1, "myvalue" # [invalid-class-object] + print(myvar) + + def class_defining_function_good_inverted(self): + myvar, self.__class__ = "myvalue", AnotherClass + print(myvar) + + def class_defining_function_bad_inverted(self): + myvar, self.__class__ = "myvalue", 1 # [invalid-class-object] + print(myvar) + + def class_defining_function_complex_bad(self): + myvar, self.__class__, other = ( # [invalid-class-object] + "myvalue", + 1, + "othervalue", + ) + print(myvar, other) + + def class_defining_function_complex_good(self): + myvar, self.__class__, other = ( + "myvalue", + str, + "othervalue", + ) + print(myvar, other) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pylint-2.15.2/tests/functional/i/invalid/invalid_class_object.txt new/pylint-2.15.3/tests/functional/i/invalid/invalid_class_object.txt --- old/pylint-2.15.2/tests/functional/i/invalid/invalid_class_object.txt 2022-09-07 14:47:49.000000000 +0200 +++ new/pylint-2.15.3/tests/functional/i/invalid/invalid_class_object.txt 2022-09-19 16:19:58.000000000 +0200 @@ -1,2 +1,5 @@ -invalid-class-object:17:0:17:11::Invalid __class__ object:UNDEFINED -invalid-class-object:18:0:18:11::Invalid __class__ object:UNDEFINED +invalid-class-object:20:0:20:11::Invalid __class__ object:UNDEFINED +invalid-class-object:21:0:21:11::Invalid __class__ object:UNDEFINED +invalid-class-object:50:8:50:22:Pylint7429Good.class_defining_function_bad:Invalid __class__ object:UNDEFINED +invalid-class-object:58:15:58:29:Pylint7429Good.class_defining_function_bad_inverted:Invalid __class__ object:UNDEFINED +invalid-class-object:62:15:62:29:Pylint7429Good.class_defining_function_complex_bad:Invalid __class__ object:UNDEFINED diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pylint-2.15.2/tests/functional/m/modified_iterating.py new/pylint-2.15.3/tests/functional/m/modified_iterating.py --- old/pylint-2.15.2/tests/functional/m/modified_iterating.py 2022-09-07 14:47:49.000000000 +0200 +++ new/pylint-2.15.3/tests/functional/m/modified_iterating.py 2022-09-19 16:19:58.000000000 +0200 @@ -105,3 +105,15 @@ """This should raise as we are deleting.""" for var in self.attribute: del var # [modified-iterating-list] + + +class MyClass2: + """Regression test for https://github.com/PyCQA/pylint/issues/7461""" + def __init__(self) -> None: + self.attribute = {} + + def my_method(self): + """This should not raise, as a copy was made.""" + for key in self.attribute: + tmp = self.attribute.copy() + tmp[key] = None diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pylint-2.15.2/tests/functional/u/undefined/undefined_loop_variable.py new/pylint-2.15.3/tests/functional/u/undefined/undefined_loop_variable.py --- old/pylint-2.15.2/tests/functional/u/undefined/undefined_loop_variable.py 2022-09-07 14:47:49.000000000 +0200 +++ new/pylint-2.15.3/tests/functional/u/undefined/undefined_loop_variable.py 2022-09-19 16:19:58.000000000 +0200 @@ -1,5 +1,13 @@ # pylint: disable=missing-docstring,redefined-builtin, consider-using-f-string, unnecessary-direct-lambda-call +import sys + +if sys.version_info >= (3, 8): + from typing import NoReturn +else: + from typing_extensions import NoReturn + + def do_stuff(some_random_list): for var in some_random_list: pass @@ -125,6 +133,18 @@ print(thing) +def for_else_no_return(iterable): + def fail() -> NoReturn: + ... + + while True: + for thing in iterable: + break + else: + fail() + print(thing) + + lst = [] lst2 = [1, 2, 3] diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pylint-2.15.2/tests/functional/u/undefined/undefined_loop_variable.txt new/pylint-2.15.3/tests/functional/u/undefined/undefined_loop_variable.txt --- old/pylint-2.15.2/tests/functional/u/undefined/undefined_loop_variable.txt 2022-09-07 14:47:49.000000000 +0200 +++ new/pylint-2.15.3/tests/functional/u/undefined/undefined_loop_variable.txt 2022-09-19 16:19:58.000000000 +0200 @@ -1,4 +1,4 @@ -undefined-loop-variable:6:11:6:14:do_stuff:Using possibly undefined loop variable 'var':UNDEFINED -undefined-loop-variable:25:7:25:11::Using possibly undefined loop variable 'var1':UNDEFINED -undefined-loop-variable:75:11:75:14:do_stuff_with_redefined_range:Using possibly undefined loop variable 'var':UNDEFINED -undefined-loop-variable:181:11:181:20:find_even_number:Using possibly undefined loop variable 'something':UNDEFINED +undefined-loop-variable:14:11:14:14:do_stuff:Using possibly undefined loop variable 'var':UNDEFINED +undefined-loop-variable:33:7:33:11::Using possibly undefined loop variable 'var1':UNDEFINED +undefined-loop-variable:83:11:83:14:do_stuff_with_redefined_range:Using possibly undefined loop variable 'var':UNDEFINED +undefined-loop-variable:201:11:201:20:find_even_number:Using possibly undefined loop variable 'something':UNDEFINED diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pylint-2.15.2/tests/functional/u/undefined/undefined_loop_variable_py311.py new/pylint-2.15.3/tests/functional/u/undefined/undefined_loop_variable_py311.py --- old/pylint-2.15.2/tests/functional/u/undefined/undefined_loop_variable_py311.py 1970-01-01 01:00:00.000000000 +0100 +++ new/pylint-2.15.3/tests/functional/u/undefined/undefined_loop_variable_py311.py 2022-09-19 16:19:58.000000000 +0200 @@ -0,0 +1,17 @@ +"""Tests for undefined-loop-variable using Python 3.11 syntax.""" + +from typing import Never + + +def for_else_never(iterable): + """Test for-else with Never type.""" + + def idontreturn() -> Never: + """This function never returns.""" + + while True: + for thing in iterable: + break + else: + idontreturn() + print(thing) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pylint-2.15.2/tests/functional/u/undefined/undefined_loop_variable_py311.rc new/pylint-2.15.3/tests/functional/u/undefined/undefined_loop_variable_py311.rc --- old/pylint-2.15.2/tests/functional/u/undefined/undefined_loop_variable_py311.rc 1970-01-01 01:00:00.000000000 +0100 +++ new/pylint-2.15.3/tests/functional/u/undefined/undefined_loop_variable_py311.rc 2022-09-19 16:19:58.000000000 +0200 @@ -0,0 +1,2 @@ +[testoptions] +min_pyver=3.11 diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pylint-2.15.2/tests/functional/u/unhashable_member.py new/pylint-2.15.3/tests/functional/u/unhashable_member.py --- old/pylint-2.15.2/tests/functional/u/unhashable_member.py 2022-09-07 14:47:49.000000000 +0200 +++ new/pylint-2.15.3/tests/functional/u/unhashable_member.py 2022-09-19 16:19:58.000000000 +0200 @@ -21,3 +21,4 @@ {[1, 2, 3]} # [unhashable-member] {"tomato": "tomahto"} {dict: {}} +{lambda x: x: "tomato"} # pylint: disable=unnecessary-lambda diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pylint-2.15.2/tests/functional/u/unused/unused_variable.py new/pylint-2.15.3/tests/functional/u/unused/unused_variable.py --- old/pylint-2.15.2/tests/functional/u/unused/unused_variable.py 2022-09-07 14:47:49.000000000 +0200 +++ new/pylint-2.15.3/tests/functional/u/unused/unused_variable.py 2022-09-19 16:19:58.000000000 +0200 @@ -94,7 +94,7 @@ variables through imports. """ # pylint: disable=redefined-outer-name - global PATH, OS, collections, deque # [global-variable-not-assigned, global-variable-not-assigned] + global PATH, OS, collections, deque # [global-statement] from os import path as PATH import os as OS import collections diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pylint-2.15.2/tests/functional/u/unused/unused_variable.txt new/pylint-2.15.3/tests/functional/u/unused/unused_variable.txt --- old/pylint-2.15.2/tests/functional/u/unused/unused_variable.txt 2022-09-07 14:47:49.000000000 +0200 +++ new/pylint-2.15.3/tests/functional/u/unused/unused_variable.txt 2022-09-19 16:19:58.000000000 +0200 @@ -13,8 +13,7 @@ unused-import:59:4:59:40:unused_import_in_function:Unused hexdigits imported from string:UNDEFINED unused-variable:64:4:64:10:hello:Unused variable 'my_var':UNDEFINED unused-variable:75:4:75:8:function:Unused variable 'aaaa':UNDEFINED -global-variable-not-assigned:97:4:97:39:test_global:Using global for 'PATH' but no assignment is done:UNDEFINED -global-variable-not-assigned:97:4:97:39:test_global:Using global for 'deque' but no assignment is done:UNDEFINED +global-statement:97:4:97:39:test_global:Using the global statement:UNDEFINED unused-import:103:4:103:28:test_global:Unused platform imported from sys:UNDEFINED unused-import:104:4:104:38:test_global:Unused version imported from sys as VERSION:UNDEFINED unused-import:105:4:105:15:test_global:Unused import this:UNDEFINED diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pylint-2.15.2/tests/test_self.py new/pylint-2.15.3/tests/test_self.py --- old/pylint-2.15.2/tests/test_self.py 2022-09-07 14:47:49.000000000 +0200 +++ new/pylint-2.15.3/tests/test_self.py 2022-09-19 16:19:58.000000000 +0200 @@ -1229,6 +1229,7 @@ [["--help-msg", "W0101"], ":unreachable (W0101)", False], [["--help-msg", "WX101"], "No such message id", False], [["--help-msg"], "--help-msg: expected at least one argumen", True], + [["--help-msg", "C0102,C0103"], ":invalid-name (C0103):", False], ], ) def test_help_msg(
