summaryrefslogtreecommitdiffstats
path: root/Python
diff options
context:
space:
mode:
authorTian Gao <gaogaotiantian@hotmail.com>2023-04-28 20:08:25 (GMT)
committerGitHub <noreply@github.com>2023-04-28 20:08:25 (GMT)
commitfee3c91a196e8c716ff86cb5e8bd3fda32f4e6a8 (patch)
tree1fc56c3672af53b7ba79762091f9b6d06e32b7ca /Python
parent4219074127221fdbf545f908361da4ad98437b45 (diff)
downloadcpython-fee3c91a196e8c716ff86cb5e8bd3fda32f4e6a8.zip
cpython-fee3c91a196e8c716ff86cb5e8bd3fda32f4e6a8.tar.gz
cpython-fee3c91a196e8c716ff86cb5e8bd3fda32f4e6a8.tar.bz2
[3.11] GH-103971: Fix incorrect locations for code following case blocks
Diffstat (limited to 'Python')
-rw-r--r--Python/compile.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/Python/compile.c b/Python/compile.c
index 2170e82..f87a423 100644
--- a/Python/compile.c
+++ b/Python/compile.c
@@ -7057,6 +7057,7 @@ compiler_match_inner(struct compiler *c, stmt_ty s, pattern_context *pc)
ADDOP(c, POP_TOP);
}
VISIT_SEQ(c, stmt, m->body);
+ UNSET_LOC(c);
ADDOP_JUMP(c, JUMP, end);
// If the pattern fails to match, we want the line number of the
// cleanup to be associated with the failed pattern, not the last line
@@ -7081,6 +7082,7 @@ compiler_match_inner(struct compiler *c, stmt_ty s, pattern_context *pc)
RETURN_IF_FALSE(compiler_jump_if(c, m->guard, end, 0));
}
VISIT_SEQ(c, stmt, m->body);
+ UNSET_LOC(c);
}
compiler_use_next_block(c, end);
return 1;