Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

GH-106529: Define POP_JUMP_IF_NONE in terms of POP_JUMP_IF_TRUE #106599

Merged
merged 3 commits into from
Jul 11, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 7 additions & 9 deletions Python/bytecodes.c
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
114 changes: 66 additions & 48 deletions Python/executor_cases.c.h

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading