summaryrefslogtreecommitdiffstats
path: root/Python/codegen.c
diff options
context:
space:
mode:
authorMark Shannon <mark@hotpy.org>2025-03-10 17:31:16 (GMT)
committerGitHub <noreply@github.com>2025-03-10 17:31:16 (GMT)
commitbe046ee6e06d3eea5f249c524861b76df6c9f003 (patch)
tree091f8f66f0c7439a0d41821d40d2d56bd18fc2ec /Python/codegen.c
parent91d6db7ee0006860a93d96c4c8bc58bfd8a38f6b (diff)
downloadcpython-be046ee6e06d3eea5f249c524861b76df6c9f003.zip
cpython-be046ee6e06d3eea5f249c524861b76df6c9f003.tar.gz
cpython-be046ee6e06d3eea5f249c524861b76df6c9f003.tar.bz2
GH-123044: Give the `POP_TOP` after a case test a location in the body, not the pattern. (GH-130627)
Diffstat (limited to 'Python/codegen.c')
-rw-r--r--Python/codegen.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/Python/codegen.c b/Python/codegen.c
index 7a3f787..9087112 100644
--- a/Python/codegen.c
+++ b/Python/codegen.c
@@ -6124,7 +6124,8 @@ codegen_match_inner(compiler *c, stmt_ty s, pattern_context *pc)
}
// Success! Pop the subject off, we're done with it:
if (i != cases - has_default - 1) {
- ADDOP(c, LOC(m->pattern), POP_TOP);
+ /* Use the next location to give better locations for branch events */
+ ADDOP(c, NEXT_LOCATION, POP_TOP);
}
VISIT_SEQ(c, stmt, m->body);
ADDOP_JUMP(c, NO_LOCATION, JUMP, end);