diff options
-rw-r--r-- | ChangeLog | 4 | ||||
-rw-r--r-- | requirements_test_min.txt | 2 | ||||
-rw-r--r-- | setup.cfg | 2 | ||||
-rw-r--r-- | tests/functional/u/used/used_before_assignment_py37.py | 7 | ||||
-rw-r--r-- | tests/functional/u/used/used_before_assignment_py37.txt | 2 |
5 files changed, 14 insertions, 3 deletions
@@ -36,6 +36,10 @@ What's New in Pylint 2.13.2? ============================ Release date: TBA +* Fix crash when subclassing a ``namedtuple``. + + Closes #5982 + * Fix false positive for ``superfluous-parens`` for patterns like "return (a or b) in iterable". diff --git a/requirements_test_min.txt b/requirements_test_min.txt index 83f1a8810..10e6ce2e0 100644 --- a/requirements_test_min.txt +++ b/requirements_test_min.txt @@ -1,6 +1,6 @@ -e .[testutil] # astroid dependency is also defined in setup.cfg -astroid==2.11.0 # Pinned to a specific version for tests +astroid==2.11.2 # Pinned to a specific version for tests typing-extensions~=4.1 pytest~=7.0 pytest-benchmark~=3.4 @@ -48,7 +48,7 @@ install_requires = # Also upgrade requirements_test_min.txt if you are bumping astroid. # Pinned to dev of next minor update to allow editable installs, # see https://github.com/PyCQA/astroid/issues/1341 - astroid>=2.11.0,<=2.12.0-dev0 + astroid>=2.11.2,<=2.12.0-dev0 isort>=4.2.5,<6 mccabe>=0.6,<0.8 tomli>=1.1.0;python_version<"3.11" diff --git a/tests/functional/u/used/used_before_assignment_py37.py b/tests/functional/u/used/used_before_assignment_py37.py index 08a585a95..c64bf7cf5 100644 --- a/tests/functional/u/used/used_before_assignment_py37.py +++ b/tests/functional/u/used/used_before_assignment_py37.py @@ -1,6 +1,7 @@ """Tests for used-before-assignment with functions added in python 3.7""" # pylint: disable=missing-function-docstring from __future__ import annotations +from collections import namedtuple from typing import List @@ -26,3 +27,9 @@ class MyClass: return self == other return inner_method(self, MyClass()) + + +class NamedTupleSubclass(namedtuple("NamedTupleSubclass", [])): + """Taken from https://github.com/PyCQA/pylint/issues/5982""" + def method(self) -> NamedTupleSubclass: + """Variables checker crashed when astroid did not supply a lineno""" diff --git a/tests/functional/u/used/used_before_assignment_py37.txt b/tests/functional/u/used/used_before_assignment_py37.txt index ad06560e2..fa0a0b77a 100644 --- a/tests/functional/u/used/used_before_assignment_py37.txt +++ b/tests/functional/u/used/used_before_assignment_py37.txt @@ -1 +1 @@ -undefined-variable:17:20:17:27:MyClass.incorrect_default_method:Undefined variable 'MyClass':UNDEFINED +undefined-variable:18:20:18:27:MyClass.incorrect_default_method:Undefined variable 'MyClass':UNDEFINED |