summaryrefslogtreecommitdiffstats
path: root/Python/compile.c
diff options
context:
space:
mode:
authorIrit Katriel <1055913+iritkatriel@users.noreply.github.com>2022-01-06 19:43:16 (GMT)
committerGitHub <noreply@github.com>2022-01-06 19:43:16 (GMT)
commit16dfabf75cd0786781bcd8ded6a12591fb893d68 (patch)
treee52010d8d259582ddaa500670a787d71ae96059e /Python/compile.c
parent9c5fa9c97c5c5336e60e4ae7a2e6e3f67acedfc7 (diff)
downloadcpython-16dfabf75cd0786781bcd8ded6a12591fb893d68.zip
cpython-16dfabf75cd0786781bcd8ded6a12591fb893d68.tar.gz
cpython-16dfabf75cd0786781bcd8ded6a12591fb893d68.tar.bz2
bpo-46286: use the new POP_JUMP_IF_NOT_NONE opcode to simplify except* (GH-30439)
Automerge-Triggered-By: GH:iritkatriel
Diffstat (limited to 'Python/compile.c')
-rw-r--r--Python/compile.c8
1 files changed, 2 insertions, 6 deletions
diff --git a/Python/compile.c b/Python/compile.c
index 62f37ca..643a5e5 100644
--- a/Python/compile.c
+++ b/Python/compile.c
@@ -3515,9 +3515,7 @@ compiler_try_except(struct compiler *c, stmt_ty s)
[orig, res] PREP_RERAISE_STAR
[exc] DUP_TOP
- [exc, exc] LOAD_CONST None
- [exc, exc, None] COMPARE_IS
- [exc, is_none] POP_JUMP_IF_FALSE RER
+ [exc, exc] POP_JUMP_IF_NOT_NONE RER
[exc] POP_TOP
[] JUMP_FORWARD L0
@@ -3687,9 +3685,7 @@ compiler_try_star_except(struct compiler *c, stmt_ty s)
compiler_use_next_block(c, reraise_star);
ADDOP(c, PREP_RERAISE_STAR);
ADDOP(c, DUP_TOP);
- ADDOP_LOAD_CONST(c, Py_None);
- ADDOP_COMPARE(c, Is);
- ADDOP_JUMP(c, POP_JUMP_IF_FALSE, reraise);
+ ADDOP_JUMP(c, POP_JUMP_IF_NOT_NONE, reraise);
NEXT_BLOCK(c);
/* Nothing to reraise */