Skip to content

Commit

Permalink
Handle IndexError & AttributeError separately.
Browse files Browse the repository at this point in the history
  • Loading branch information
mbyrnepr2 committed May 7, 2022
1 parent 8357070 commit f644326
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions pylint/checkers/utils.py
Expand Up @@ -849,9 +849,12 @@ def uninferable_final_decorators(
for decorator in getattr(node, "nodes", []):
if isinstance(decorator, nodes.Attribute):
try:
import_node = decorator.expr.lookup(decorator.expr.name)[1][0]
except (AttributeError, IndexError):
_, import_nodes = decorator.expr.lookup(decorator.expr.name)
except AttributeError:
continue
if not import_nodes:
continue
import_node = import_nodes[0]
elif isinstance(decorator, nodes.Name):
lookup_values = decorator.lookup(decorator.name)
if lookup_values[1]:
Expand Down

0 comments on commit f644326

Please sign in to comment.