summaryrefslogtreecommitdiff
path: root/pylint/checkers/refactoring.py
diff options
context:
space:
mode:
authorClaudiu Popa <pcmanticore@gmail.com>2020-03-08 18:06:03 +0100
committerClaudiu Popa <pcmanticore@gmail.com>2020-03-08 18:06:03 +0100
commitce58d6e87ac1588311699a30aeb16b60a041fb23 (patch)
tree304aff6621360b91fdc3a07dcc7b2b0d422b1b82 /pylint/checkers/refactoring.py
parente964c89cd6e0296b4c52e5b5b316b957dc6a21f8 (diff)
downloadpylint-git-ce58d6e87ac1588311699a30aeb16b60a041fb23.tar.gz
Protect against `exc` not having `pytype`
`pytype` is not defined on all nodes, but line 1175 assumed the result of `safe_infer()` might have it.
Diffstat (limited to 'pylint/checkers/refactoring.py')
-rw-r--r--pylint/checkers/refactoring.py2
1 files changed, 1 insertions, 1 deletions
diff --git a/pylint/checkers/refactoring.py b/pylint/checkers/refactoring.py
index 28313439a..4fd988471 100644
--- a/pylint/checkers/refactoring.py
+++ b/pylint/checkers/refactoring.py
@@ -1170,7 +1170,7 @@ class RefactoringChecker(checkers.BaseTokenChecker):
#  to infer it.
return True
exc = utils.safe_infer(node.exc)
- if exc is None or exc is astroid.Uninferable:
+ if exc is None or exc is astroid.Uninferable or not hasattr(exc, "pytype"):
return False
exc_name = exc.pytype().split(".")[-1]
handlers = utils.get_exception_handlers(node, exc_name)