diff options
author | penguin_wwy <940375606@qq.com> | 2022-01-06 11:38:35 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-01-06 11:38:35 (GMT) |
commit | 3db762db72cc0da938614b1e414abb1e12ca4094 (patch) | |
tree | eef08b55d931522d2f83ed7b6f2383d27d8a4ffe /Python/ceval.c | |
parent | 35d6540c904ef07b8602ff014e520603f84b5886 (diff) | |
download | cpython-3db762db72cc0da938614b1e414abb1e12ca4094.zip cpython-3db762db72cc0da938614b1e414abb1e12ca4094.tar.gz cpython-3db762db72cc0da938614b1e414abb1e12ca4094.tar.bz2 |
bpo-46031: add POP_JUMP_IF_NOT_NONE and POP_JUMP_IF_NONE (GH-30019)
Diffstat (limited to 'Python/ceval.c')
-rw-r--r-- | Python/ceval.c | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/Python/ceval.c b/Python/ceval.c index b4ac9ec..86d834c 100644 --- a/Python/ceval.c +++ b/Python/ceval.c @@ -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; |