summaryrefslogtreecommitdiffstats
path: root/Python/compile.c
diff options
context:
space:
mode:
authorIrit Katriel <1055913+iritkatriel@users.noreply.github.com>2023-06-14 23:14:22 (GMT)
committerGitHub <noreply@github.com>2023-06-14 23:14:22 (GMT)
commitd1b0297d3e1cb4f9f53070e6c0a5fd6722bdf6ee (patch)
tree5849dfa6be4e9d5432fe5c5a2771755216fc4834 /Python/compile.c
parent5ab13c5f97aa5226c49052f1ad19a8c97a3d7cdf (diff)
downloadcpython-d1b0297d3e1cb4f9f53070e6c0a5fd6722bdf6ee.zip
cpython-d1b0297d3e1cb4f9f53070e6c0a5fd6722bdf6ee.tar.gz
cpython-d1b0297d3e1cb4f9f53070e6c0a5fd6722bdf6ee.tar.bz2
gh-105481: add HAS_JUMP flag to opcode metadata (#105791)
Diffstat (limited to 'Python/compile.c')
-rw-r--r--Python/compile.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/Python/compile.c b/Python/compile.c
index daeb4db..afb7b7d 100644
--- a/Python/compile.c
+++ b/Python/compile.c
@@ -248,8 +248,11 @@ instr_sequence_use_label(instr_sequence *seq, int lbl) {
static int
instr_sequence_addop(instr_sequence *seq, int opcode, int oparg, location loc)
{
+ /* compare old and new opcode macros - use ! to compare as bools. */
assert(!HAS_ARG(opcode) == !OPCODE_HAS_ARG(opcode));
assert(!HAS_CONST(opcode) == !OPCODE_HAS_CONST(opcode));
+ assert(!OPCODE_HAS_JUMP(opcode) == !OPCODE_HAS_JUMP(opcode));
+
assert(0 <= opcode && opcode <= MAX_OPCODE);
assert(IS_PSEUDO_OPCODE(opcode) == IS_PSEUDO_INSTR(opcode));
assert(IS_WITHIN_OPCODE_RANGE(opcode));
@@ -1114,7 +1117,7 @@ codegen_addop_j(instr_sequence *seq, location loc,
int opcode, jump_target_label target)
{
assert(IS_LABEL(target));
- assert(IS_JUMP_OPCODE(opcode) || IS_BLOCK_PUSH_OPCODE(opcode));
+ assert(OPCODE_HAS_JUMP(opcode) || IS_BLOCK_PUSH_OPCODE(opcode));
assert(!IS_ASSEMBLER_OPCODE(opcode));
return instr_sequence_addop(seq, opcode, target.id, loc);
}