diff options
author | Irit Katriel <1055913+iritkatriel@users.noreply.github.com> | 2024-09-25 14:51:25 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-09-25 14:51:25 (GMT) |
commit | 78aeb38f7d880a340295214abc4f7e77ffdad509 (patch) | |
tree | 8944d52302e56f98bef775d2599c6eee3c4db3b6 /Python/codegen.c | |
parent | c58c572a65eb5b93d054e779df289e975a0b9864 (diff) | |
download | cpython-78aeb38f7d880a340295214abc4f7e77ffdad509.zip cpython-78aeb38f7d880a340295214abc4f7e77ffdad509.tar.gz cpython-78aeb38f7d880a340295214abc4f7e77ffdad509.tar.bz2 |
gh-124285: Fix bug where bool() is called multiple times for the same part of a boolean expression (#124394)
Diffstat (limited to 'Python/codegen.c')
-rw-r--r-- | Python/codegen.c | 6 |
1 files changed, 2 insertions, 4 deletions
diff --git a/Python/codegen.c b/Python/codegen.c index 0305f42..896c30c 100644 --- a/Python/codegen.c +++ b/Python/codegen.c @@ -3140,17 +3140,15 @@ codegen_boolop(compiler *c, expr_ty e) location loc = LOC(e); assert(e->kind == BoolOp_kind); if (e->v.BoolOp.op == And) - jumpi = POP_JUMP_IF_FALSE; + jumpi = JUMP_IF_FALSE; else - jumpi = POP_JUMP_IF_TRUE; + jumpi = JUMP_IF_TRUE; NEW_JUMP_TARGET_LABEL(c, end); s = e->v.BoolOp.values; n = asdl_seq_LEN(s) - 1; assert(n >= 0); for (i = 0; i < n; ++i) { VISIT(c, expr, (expr_ty)asdl_seq_GET(s, i)); - ADDOP_I(c, loc, COPY, 1); - ADDOP(c, loc, TO_BOOL); ADDOP_JUMP(c, loc, jumpi, end); ADDOP(c, loc, POP_TOP); } |