summaryrefslogtreecommitdiffstats
path: root/Python/bytecodes.c
diff options
context:
space:
mode:
authorMark Shannon <mark@hotpy.org>2023-07-11 10:33:59 (GMT)
committerGitHub <noreply@github.com>2023-07-11 10:33:59 (GMT)
commitc0c041a31ba6a8d2da993a475a56b7d8211fdbf2 (patch)
treefe5d49e55705ba87b2b7a597aab7d1b32e631d54 /Python/bytecodes.c
parent1f2921b72c369b19c2e32aaedb9f8c63e0cb8b48 (diff)
downloadcpython-c0c041a31ba6a8d2da993a475a56b7d8211fdbf2.zip
cpython-c0c041a31ba6a8d2da993a475a56b7d8211fdbf2.tar.gz
cpython-c0c041a31ba6a8d2da993a475a56b7d8211fdbf2.tar.bz2
GH-106529: Define POP_JUMP_IF_NONE in terms of POP_JUMP_IF_TRUE (GH-106599)
Diffstat (limited to 'Python/bytecodes.c')
-rw-r--r--Python/bytecodes.c16
1 files changed, 7 insertions, 9 deletions
diff --git a/Python/bytecodes.c b/Python/bytecodes.c
index 8844429..3ba0d0f 100644
--- a/Python/bytecodes.c
+++ b/Python/bytecodes.c
@@ -2282,22 +2282,20 @@ dummy_func(
JUMPBY(oparg * Py_IsTrue(cond));
}
- inst(POP_JUMP_IF_NOT_NONE, (value -- )) {
- if (!Py_IsNone(value)) {
- DECREF_INPUTS();
- JUMPBY(oparg);
- }
- }
-
- inst(POP_JUMP_IF_NONE, (value -- )) {
+ op(IS_NONE, (value -- b)) {
if (Py_IsNone(value)) {
- JUMPBY(oparg);
+ b = Py_True;
}
else {
+ b = Py_False;
DECREF_INPUTS();
}
}
+ macro(POP_JUMP_IF_NONE) = IS_NONE + POP_JUMP_IF_TRUE;
+
+ macro(POP_JUMP_IF_NOT_NONE) = IS_NONE + POP_JUMP_IF_FALSE;
+
inst(JUMP_BACKWARD_NO_INTERRUPT, (--)) {
/* This bytecode is used in the `yield from` or `await` loop.
* If there is an interrupt, we want it handled in the innermost