mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-18 09:34:34 +07:00
PY-79986 For loop inside finally statement marked unreachable
Merge-request: IJ-MR-158267 Merged-by: Aleksandr Govenko <aleksandr.govenko@jetbrains.com> GitOrigin-RevId: 52d7e16c4a6c339773ecbe90fe5d26d7d5ddfb03
This commit is contained in:
committed by
intellij-monorepo-bot
parent
f241ee62a1
commit
a04f2e9512
+1
-1
@@ -769,7 +769,7 @@ public class PyControlFlowBuilder extends PyRecursiveElementVisitor {
|
||||
myBuilder.flowAbrupted();
|
||||
finallyFailInstruction = myBuilder.startNode(finallyPart);
|
||||
finallyPart.accept(this);
|
||||
myBuilder.addNode(new PyFinallyFailExitInstruction(myBuilder, finallyFailInstruction));
|
||||
myBuilder.addNodeAndCheckPending(new PyFinallyFailExitInstruction(myBuilder, finallyFailInstruction));
|
||||
myBuilder.addPendingEdge(null, myBuilder.prevInstruction);
|
||||
myBuilder.flowAbrupted();
|
||||
}
|
||||
|
||||
@@ -24,6 +24,18 @@ public class PyUnreachableCodeInspectionTest extends PyInspectionTestCase {
|
||||
public void testUnreachable() {
|
||||
runWithLanguageLevel(LanguageLevel.PYTHON26, () -> doTest());
|
||||
}
|
||||
|
||||
// PY-79986
|
||||
public void testForInsideFinally() {
|
||||
doTestByText("""
|
||||
def bar():
|
||||
try:
|
||||
return
|
||||
finally:
|
||||
for i in range(10):
|
||||
print("reachable")
|
||||
""");
|
||||
}
|
||||
|
||||
// PY-51564
|
||||
public void testWithNotContext() {
|
||||
|
||||
Reference in New Issue
Block a user