diff --git a/ChangeLog b/ChangeLog index 8ed717f2a77..09034fd8765 100644 --- a/ChangeLog +++ b/ChangeLog @@ -26,6 +26,11 @@ Release date: TBA Closes #4692 +* Fix a crash when there would be a 'TypeError object does not support + item assignment' in the code we parse. + + Closes #4439 + What's New in Pylint 2.9.4? =========================== diff --git a/tests/functional/r/regression/regression_4439.py b/tests/functional/r/regression/regression_4439.py new file mode 100644 index 00000000000..966cc80067e --- /dev/null +++ b/tests/functional/r/regression/regression_4439.py @@ -0,0 +1,13 @@ +"""AttributeError: 'Subscript' object has no attribute 'name' """ +# pylint: disable=missing-docstring + +from typing import Optional + +from attr import attrib, attrs + + +@attrs() +class User: + name: str = attrib() + age: int = attrib() + occupation = Optional[str] = attrib(default=None) # [unsupported-assignment-operation] diff --git a/tests/functional/r/regression/regression_4439.txt b/tests/functional/r/regression/regression_4439.txt new file mode 100644 index 00000000000..1fe96738d4a --- /dev/null +++ b/tests/functional/r/regression/regression_4439.txt @@ -0,0 +1 @@ +unsupported-assignment-operation:13:17:User:'Optional' does not support item assignment:HIGH