Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add a regression test for AttributeError for Subscript object #4730

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
5 changes: 5 additions & 0 deletions ChangeLog
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,11 @@ Release date: TBA
..
Put bug fixes that should not wait for a new minor version here

* Fix a crash when there would be a 'TypeError object does not support
item assignment' in the code we parse.

Closes #4439

* Fix crash if a callable returning a context manager was assigned to a list or dict item

Closes #4732
Expand Down
2 changes: 1 addition & 1 deletion requirements_test_min.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
-e .
astroid==2.6.4 # Pinned to a specific version for tests
astroid==2.6.5 # Pinned to a specific version for tests
pytest~=6.2
pytest-benchmark~=3.4
2 changes: 1 addition & 1 deletion setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ project_urls =
[options]
packages = find:
install_requires =
astroid>=2.6.4,<2.7 # (You should also upgrade requirements_test_min.txt)
astroid>=2.6.5,<2.7 # (You should also upgrade requirements_test_min.txt)
isort>=4.2.5,<6
mccabe>=0.6,<0.7
toml>=0.7.1
Expand Down
13 changes: 13 additions & 0 deletions tests/functional/r/regression/regression_4439.py
Original file line number Diff line number Diff line change
@@ -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]
1 change: 1 addition & 0 deletions tests/functional/r/regression/regression_4439.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
unsupported-assignment-operation:13:17:User:'Optional' does not support item assignment:HIGH