summaryrefslogtreecommitdiffstats
path: root/Python/compile.c
diff options
context:
space:
mode:
authorMark Shannon <mark@hotpy.org>2024-08-13 09:25:44 (GMT)
committerGitHub <noreply@github.com>2024-08-13 09:25:44 (GMT)
commitfe23f8ed970425828de20fb48750fa89da914886 (patch)
tree4bcd11c9d4f579a73345b0212d126e764c5ba662 /Python/compile.c
parent0e207f3e7adc6a0fdbe1482ce01163ff04d5ddcb (diff)
downloadcpython-fe23f8ed970425828de20fb48750fa89da914886.zip
cpython-fe23f8ed970425828de20fb48750fa89da914886.tar.gz
cpython-fe23f8ed970425828de20fb48750fa89da914886.tar.bz2
GH-122821: Simplify compilation of while statements to ensure consistency of offsets for sys.monitoring (GH-122934)
Diffstat (limited to 'Python/compile.c')
-rw-r--r--Python/compile.c4
1 files changed, 1 insertions, 3 deletions
diff --git a/Python/compile.c b/Python/compile.c
index 9695a99..0efa747 100644
--- a/Python/compile.c
+++ b/Python/compile.c
@@ -3051,7 +3051,6 @@ static int
compiler_while(struct compiler *c, stmt_ty s)
{
NEW_JUMP_TARGET_LABEL(c, loop);
- NEW_JUMP_TARGET_LABEL(c, body);
NEW_JUMP_TARGET_LABEL(c, end);
NEW_JUMP_TARGET_LABEL(c, anchor);
@@ -3060,9 +3059,8 @@ compiler_while(struct compiler *c, stmt_ty s)
RETURN_IF_ERROR(compiler_push_fblock(c, LOC(s), WHILE_LOOP, loop, end, NULL));
RETURN_IF_ERROR(compiler_jump_if(c, LOC(s), s->v.While.test, anchor, 0));
- USE_LABEL(c, body);
VISIT_SEQ(c, stmt, s->v.While.body);
- RETURN_IF_ERROR(compiler_jump_if(c, LOC(s), s->v.While.test, body, 1));
+ ADDOP_JUMP(c, NO_LOCATION, JUMP, loop);
compiler_pop_fblock(c, WHILE_LOOP, loop);