diff options
author | Miss Islington (bot) <31488909+miss-islington@users.noreply.github.com> | 2021-08-31 18:08:32 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-08-31 18:08:32 (GMT) |
commit | ebbd0ac5d8850a1630090c210b2454b4b26c7daa (patch) | |
tree | 33eb566a9fac673f0fadffc15682507b31a47f96 | |
parent | 337c8adf31c46b688a5f82bcb64dc6f1ad56703d (diff) | |
download | cpython-ebbd0ac5d8850a1630090c210b2454b4b26c7daa.zip cpython-ebbd0ac5d8850a1630090c210b2454b4b26c7daa.tar.gz cpython-ebbd0ac5d8850a1630090c210b2454b4b26c7daa.tar.bz2 |
bpo-45039: Consistently use ADDOP_LOAD_CONST in compiler rather than ADDOP_O(c, LOAD_CONST,...) (GH-28015)
(cherry picked from commit 70ccee418d1f9d34ed15cfe7104221f9cfd27d03)
Co-authored-by: Irit Katriel <1055913+iritkatriel@users.noreply.github.com>
-rw-r--r-- | Python/compile.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/Python/compile.c b/Python/compile.c index d55b0be..baea494 100644 --- a/Python/compile.c +++ b/Python/compile.c @@ -1568,12 +1568,14 @@ compiler_addop_j_noline(struct compiler *c, int opcode, basicblock *b) } #define ADDOP_O(C, OP, O, TYPE) { \ + assert((OP) != LOAD_CONST); /* use ADDOP_LOAD_CONST */ \ if (!compiler_addop_o((C), (OP), (C)->u->u_ ## TYPE, (O))) \ return 0; \ } /* Same as ADDOP_O, but steals a reference. */ #define ADDOP_N(C, OP, O, TYPE) { \ + assert((OP) != LOAD_CONST); /* use ADDOP_LOAD_CONST_NEW */ \ if (!compiler_addop_o((C), (OP), (C)->u->u_ ## TYPE, (O))) { \ Py_DECREF((O)); \ return 0; \ @@ -1751,7 +1753,7 @@ compiler_pop_fblock(struct compiler *c, enum fblocktype t, basicblock *b) static int compiler_call_exit_with_nones(struct compiler *c) { - ADDOP_O(c, LOAD_CONST, Py_None, consts); + ADDOP_LOAD_CONST(c, Py_None); ADDOP(c, DUP_TOP); ADDOP(c, DUP_TOP); ADDOP_I(c, CALL_FUNCTION, 3); @@ -5062,7 +5064,7 @@ compiler_async_with(struct compiler *c, stmt_ty s, int pos) if(!compiler_call_exit_with_nones(c)) return 0; ADDOP(c, GET_AWAITABLE); - ADDOP_O(c, LOAD_CONST, Py_None, consts); + ADDOP_LOAD_CONST(c, Py_None); ADDOP(c, YIELD_FROM); ADDOP(c, POP_TOP); |