Skip to content
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.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions ChangeLog
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,8 @@ Release date: TBA

Closes #5323

* Fixed crash on uninferable decorators on Python 3.6 and 3.7

* Add checker ``unnecessary-ellipsis``: Emitted when the ellipsis constant is used unnecessarily.

Closes #5460
Expand Down
2 changes: 2 additions & 0 deletions doc/whatsnew/2.13.rst
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,8 @@ Other Changes

Closes #5065

* Fixed crash on uninferable decorators on Python 3.6 and 3.7

* Fatal errors now emit a score of 0.0 regardless of whether the linted module
contained any statements

Expand Down
6 changes: 5 additions & 1 deletion pylint/checkers/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -876,7 +876,11 @@ def uninferable_final_decorators(
except AttributeError:
continue
elif isinstance(decorator, nodes.Name):
import_node = decorator.lookup(decorator.name)[1][0]
lookup_values = decorator.lookup(decorator.name)
if lookup_values[1]:
import_node = lookup_values[1][0]
else:
continue # pragma: no cover # Covered on Python < 3.8
else:
continue

Expand Down
6 changes: 6 additions & 0 deletions tests/functional/o/overridden_final_method_regression.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
"""Test a crash regression for the overridden-final-method checker on uninferable decorators"""


@unknown_decorator # [undefined-variable]
def crash_test():
"""A docstring"""
1 change: 1 addition & 0 deletions tests/functional/o/overridden_final_method_regression.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
undefined-variable:4:1:4:18:crash_test:Undefined variable 'unknown_decorator':UNDEFINED