Skip to content

Commit

Permalink
Add a regression test for AttributeError for Subscript object
Browse files Browse the repository at this point in the history
Closes #4439
  • Loading branch information
Pierre-Sassoulas committed Jul 21, 2021
1 parent fc73e70 commit cafe3b4
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 0 deletions.
5 changes: 5 additions & 0 deletions ChangeLog
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
13 changes: 13 additions & 0 deletions 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]
1 change: 1 addition & 0 deletions tests/functional/r/regression/regression_4439.txt
@@ -0,0 +1 @@
unsupported-assignment-operation:13:17:User:'Optional' does not support item assignment:HIGH

0 comments on commit cafe3b4

Please sign in to comment.