summaryrefslogtreecommitdiffstats
path: root/Python/bytecodes.c
diff options
context:
space:
mode:
authorIrit Katriel <1055913+iritkatriel@users.noreply.github.com>2024-09-25 14:51:25 (GMT)
committerGitHub <noreply@github.com>2024-09-25 14:51:25 (GMT)
commit78aeb38f7d880a340295214abc4f7e77ffdad509 (patch)
tree8944d52302e56f98bef775d2599c6eee3c4db3b6 /Python/bytecodes.c
parentc58c572a65eb5b93d054e779df289e975a0b9864 (diff)
downloadcpython-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/bytecodes.c')
-rw-r--r--Python/bytecodes.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/Python/bytecodes.c b/Python/bytecodes.c
index 5f194ae..bf8f6af 100644
--- a/Python/bytecodes.c
+++ b/Python/bytecodes.c
@@ -2570,6 +2570,14 @@ dummy_func(
JUMP_BACKWARD_NO_INTERRUPT,
};
+ pseudo(JUMP_IF_FALSE, (cond -- cond)) = [
+ COPY, TO_BOOL, POP_JUMP_IF_FALSE,
+ ];
+
+ pseudo(JUMP_IF_TRUE, (cond -- cond)) = [
+ COPY, TO_BOOL, POP_JUMP_IF_TRUE,
+ ];
+
tier1 inst(ENTER_EXECUTOR, (--)) {
#ifdef _Py_TIER2
PyCodeObject *code = _PyFrame_GetCode(frame);