summaryrefslogtreecommitdiff
path: root/pylint/checkers/refactoring.py
diff options
context:
space:
mode:
authorhippo91 <guillaume.peillex@gmail.com>2018-01-28 20:01:38 +0100
committerhippo91 <guillaume.peillex@gmail.com>2018-01-28 20:01:38 +0100
commitccf2261d7fae2fd988fa40dd39abbbcae1a5c344 (patch)
tree9f52fe15cb760ba9fd494fb0c3520bee3fabb3cd /pylint/checkers/refactoring.py
parent9e17f0c3864feb800ab19d4513d1fc63927d8e4f (diff)
downloadpylint-git-ccf2261d7fae2fd988fa40dd39abbbcae1a5c344.tar.gz
Backport of PR#1855
Diffstat (limited to 'pylint/checkers/refactoring.py')
-rw-r--r--pylint/checkers/refactoring.py5
1 files changed, 5 insertions, 0 deletions
diff --git a/pylint/checkers/refactoring.py b/pylint/checkers/refactoring.py
index 1f437799d..75a36af06 100644
--- a/pylint/checkers/refactoring.py
+++ b/pylint/checkers/refactoring.py
@@ -568,6 +568,11 @@ class RefactoringChecker(checkers.BaseTokenChecker):
if not node.exc:
# Ignore bare raises
return True
+ if not utils.is_node_inside_try_except(node):
+ # If the raise statement is not inside a try/except statement
+ # then the exception is raised and cannot be caught. No need
+ # to infer it.
+ return True
exc = utils.safe_infer(node.exc)
if exc is None or exc is astroid.Uninferable:
return False