GH-106529: Define POP_JUMP_IF_NONE in terms of POP_JUMP_IF_TRUE (GH-106599)

This commit is contained in:
Mark Shannon 2023-07-11 11:33:59 +01:00 committed by GitHub
parent 1f2921b72c
commit c0c041a31b
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 283 additions and 237 deletions

View file

@ -2282,21 +2282,19 @@ dummy_func(
JUMPBY(oparg * Py_IsTrue(cond));
}
inst(POP_JUMP_IF_NOT_NONE, (value -- )) {
if (!Py_IsNone(value)) {
op(IS_NONE, (value -- b)) {
if (Py_IsNone(value)) {
b = Py_True;
}
else {
b = Py_False;
DECREF_INPUTS();
JUMPBY(oparg);
}
}
inst(POP_JUMP_IF_NONE, (value -- )) {
if (Py_IsNone(value)) {
JUMPBY(oparg);
}
else {
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.