mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-18 09:34:34 +07:00
PY-82712 False positive unreachable code after try / finally block if try has an if
GitOrigin-RevId: 53c13421523d780995fa83cc0625f6e99d5fe51f
This commit is contained in:
committed by
intellij-monorepo-bot
parent
a87109d664
commit
cb34fe5953
+1
-1
@@ -500,7 +500,7 @@ public class PyControlFlowBuilder extends PyRecursiveElementVisitor {
|
||||
}
|
||||
|
||||
exitInstructions.add(myBuilder.prevInstruction);
|
||||
myBuilder.prevInstruction = addTransparentInstruction();
|
||||
myBuilder.prevInstruction = addTransparentInstruction(node);
|
||||
|
||||
for (Instruction exitInstruction : Lists.reverse(exitInstructions)) {
|
||||
myBuilder.addEdge(exitInstruction, myBuilder.prevInstruction);
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
3(16) exit context manager: context_manager
|
||||
4(5,3) element: PyIfStatement
|
||||
5(6,7,3) READ ACCESS: c
|
||||
6(13) element: null. Condition: c:false
|
||||
6(13,3) element: null. Condition: c:false
|
||||
7(8) element: null. Condition: c:true
|
||||
8(3,9) ASSERTTYPE ACCESS: c
|
||||
9(10) element: PyStatementList
|
||||
|
||||
@@ -24,6 +24,21 @@ public class PyUnreachableCodeInspectionTest extends PyInspectionTestCase {
|
||||
public void testUnreachable() {
|
||||
runWithLanguageLevel(LanguageLevel.PYTHON26, () -> doTest());
|
||||
}
|
||||
|
||||
// PY-82712
|
||||
public void testIfInsideTryExcept() {
|
||||
doTestByText("""
|
||||
try:
|
||||
if a==1:
|
||||
print(0)
|
||||
else:
|
||||
print(1)
|
||||
finally:
|
||||
print(2)
|
||||
print("Reachable")
|
||||
""");
|
||||
}
|
||||
|
||||
|
||||
// PY-81482
|
||||
public void testTryAssertFinally() {
|
||||
|
||||
Reference in New Issue
Block a user