diff --git a/python/src/com/jetbrains/python/codeInsight/controlflow/PyControlFlowBuilder.java b/python/src/com/jetbrains/python/codeInsight/controlflow/PyControlFlowBuilder.java index 90eaada7446d..663f795a4429 100644 --- a/python/src/com/jetbrains/python/codeInsight/controlflow/PyControlFlowBuilder.java +++ b/python/src/com/jetbrains/python/codeInsight/controlflow/PyControlFlowBuilder.java @@ -68,7 +68,8 @@ public class PyControlFlowBuilder extends PyRecursiveElementVisitor { public void visitPyCallExpression(final PyCallExpression node) { final PyExpression callee = node.getCallee(); // Flow abrupted - if (callee != null && "sys.exit".equals(PyUtil.getReadableRepr(callee, true))) { + if (callee != null && ("sys.exit".equals(PyUtil.getReadableRepr(callee, true)) || + "fail".equals(callee.getName()))) { callee.accept(this); for (PyExpression expression : node.getArguments()) { expression.accept(this); diff --git a/python/testData/inspections/PyUnreachableCodeInspection/expected.xml b/python/testData/inspections/PyUnreachableCodeInspection/expected.xml index f455dfd911bb..5781925361ab 100644 --- a/python/testData/inspections/PyUnreachableCodeInspection/expected.xml +++ b/python/testData/inspections/PyUnreachableCodeInspection/expected.xml @@ -26,16 +26,19 @@ 30 This code is unreachable - unreachable.py 36 This code is unreachable - unreachable.py 46 This code is unreachable + + unreachable.py + 69 + This code is unreachable +