diff options
author | Marc Mueller <30130371+cdce8p@users.noreply.github.com> | 2021-10-05 13:07:53 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-10-05 13:07:53 +0200 |
commit | f193806ed4eeb5d311523de54ff9fb83d64c57e9 (patch) | |
tree | b976eeaf4b9e1b7f141b738486aee4d3e59efc19 /tests | |
parent | 92e48052c62163e6b8511f7497a9169f355d7164 (diff) | |
download | pylint-git-f193806ed4eeb5d311523de54ff9fb83d64c57e9.tar.gz |
Fix crash with AssignAttr in TYPE_CHECKING blocks (#5118)
Diffstat (limited to 'tests')
-rw-r--r-- | tests/functional/u/undefined/undefined_variable.py | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/tests/functional/u/undefined/undefined_variable.py b/tests/functional/u/undefined/undefined_variable.py index b4e1f8335..23cf1a31b 100644 --- a/tests/functional/u/undefined/undefined_variable.py +++ b/tests/functional/u/undefined/undefined_variable.py @@ -328,3 +328,13 @@ def decorated3(x): @decorator(x * x * y for x in range(3)) # [undefined-variable] def decorated4(x): print(x) + + +# https://github.com/PyCQA/pylint/issues/5111 +# AssignAttr in orelse block of 'TYPE_CHECKING' shouldn't crash +# Name being assigned must be imported in orelse block +if TYPE_CHECKING: + pass +else: + from types import GenericAlias + object().__class_getitem__ = classmethod(GenericAlias) |