diff options
author | hippo91 <guillaume.peillex@gmail.com> | 2018-01-28 20:01:38 +0100 |
---|---|---|
committer | hippo91 <guillaume.peillex@gmail.com> | 2018-01-28 20:01:38 +0100 |
commit | ccf2261d7fae2fd988fa40dd39abbbcae1a5c344 (patch) | |
tree | 9f52fe15cb760ba9fd494fb0c3520bee3fabb3cd /pylint/checkers/refactoring.py | |
parent | 9e17f0c3864feb800ab19d4513d1fc63927d8e4f (diff) | |
download | pylint-git-ccf2261d7fae2fd988fa40dd39abbbcae1a5c344.tar.gz |
Backport of PR#1855
Diffstat (limited to 'pylint/checkers/refactoring.py')
-rw-r--r-- | pylint/checkers/refactoring.py | 5 |
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 |