PY-81608 False positive "This code is unreachable" after try / finally if try has a while loop

(cherry picked from commit fbdefd71c5c9356c82d3c873426dd565dd95c613)

IJ-MR-169577

GitOrigin-RevId: b428a790336656088c9b3343a2f6772873cafca8
This commit is contained in:
Aleksandr.Govenko
2025-07-17 15:56:36 +02:00
committed by intellij-monorepo-bot
parent 7e0924c394
commit 6deddd7ee2
3 changed files with 15 additions and 2 deletions

View File

@@ -1134,7 +1134,7 @@ public class PyControlFlowBuilder extends PyRecursiveElementVisitor {
* }</pre>
*/
private void collectInternalPendingEdges(@NotNull PyElement node) {
myBuilder.addNode(new TransparentInstructionImpl(myBuilder, null, "")); // exit
myBuilder.addNode(new TransparentInstructionImpl(myBuilder, node, "")); // exit
myBuilder.processPending((pendingScope, instruction) -> {
if (pendingScope != null && PsiTreeUtil.isAncestor(node, pendingScope, false)) {
myBuilder.addEdge(instruction, myBuilder.prevInstruction); // to exit