]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
bpo-46286: use the new POP_JUMP_IF_NOT_NONE opcode to simplify except* (GH-30439)
authorIrit Katriel <1055913+iritkatriel@users.noreply.github.com>
Thu, 6 Jan 2022 19:43:16 +0000 (19:43 +0000)
committerGitHub <noreply@github.com>
Thu, 6 Jan 2022 19:43:16 +0000 (11:43 -0800)
Automerge-Triggered-By: GH:iritkatriel
Python/compile.c

index 62f37ca452632d9148943cc127558c8f3727b46a..643a5e507712c175f434934894cd912eb15b7deb 100644 (file)
@@ -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 */