summaryrefslogtreecommitdiffstats
path: root/Python/compile.c
diff options
context:
space:
mode:
authorMark Shannon <mark@hotpy.org>2022-02-15 09:35:16 (GMT)
committerGitHub <noreply@github.com>2022-02-15 09:35:16 (GMT)
commit3be1a443ca8e7d4ba85f95b78df5c4122cae9ede (patch)
tree78b67b7f1b7a583bda33bf7f0788a55569f19287 /Python/compile.c
parent12360aa159c42c7798fd14225d271e6fd84db7eb (diff)
downloadcpython-3be1a443ca8e7d4ba85f95b78df5c4122cae9ede.zip
cpython-3be1a443ca8e7d4ba85f95b78df5c4122cae9ede.tar.gz
cpython-3be1a443ca8e7d4ba85f95b78df5c4122cae9ede.tar.bz2
bpo-46724: Use `JUMP_ABSOLUTE` for all backward jumps. (GH-31326)
* Make sure all backward jumps use JUMP_ABSOLUTE. * Add news. * Fix up news item. * Make test use consistent style.
Diffstat (limited to 'Python/compile.c')
-rw-r--r--Python/compile.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/Python/compile.c b/Python/compile.c
index 1cf20d3..786ef4e 100644
--- a/Python/compile.c
+++ b/Python/compile.c
@@ -7534,6 +7534,11 @@ normalize_jumps(struct assembler *a)
last->i_opcode = JUMP_FORWARD;
}
}
+ if (last->i_opcode == JUMP_FORWARD) {
+ if (last->i_target->b_visited == 1) {
+ last->i_opcode = JUMP_ABSOLUTE;
+ }
+ }
}
}