bpo-46031: add POP_JUMP_IF_NOT_NONE and POP_JUMP_IF_NONE (GH-30019)

This commit is contained in:
penguin_wwy 2022-01-06 19:38:35 +08:00 committed by GitHub
parent 35d6540c90
commit 3db762db72
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
9 changed files with 86 additions and 14 deletions

View file

@ -4049,6 +4049,30 @@ check_eval_breaker:
DISPATCH();
}
TARGET(POP_JUMP_IF_NOT_NONE) {
PyObject *value = POP();
if (!Py_IsNone(value)) {
Py_DECREF(value);
JUMPTO(oparg);
CHECK_EVAL_BREAKER();
DISPATCH();
}
Py_DECREF(value);
DISPATCH();
}
TARGET(POP_JUMP_IF_NONE) {
PyObject *value = POP();
if (Py_IsNone(value)) {
Py_DECREF(value);
JUMPTO(oparg);
CHECK_EVAL_BREAKER();
DISPATCH();
}
Py_DECREF(value);
DISPATCH();
}
TARGET(JUMP_IF_FALSE_OR_POP) {
PyObject *cond = TOP();
int err;