diff options
author | Brandt Bucher <brandtbucher@microsoft.com> | 2022-09-07 04:07:20 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-09-07 04:07:20 (GMT) |
commit | 0d04b8d9e1953d2311f78b772f21c9e07fbcbb6d (patch) | |
tree | e8de00a1e5b03b55c6c6794664de28e5502921c9 /Python | |
parent | 56d9cf7fc87d2cd7b8231c44f1d710ee77fbb998 (diff) | |
download | cpython-0d04b8d9e1953d2311f78b772f21c9e07fbcbb6d.zip cpython-0d04b8d9e1953d2311f78b772f21c9e07fbcbb6d.tar.gz cpython-0d04b8d9e1953d2311f78b772f21c9e07fbcbb6d.tar.bz2 |
GH-91432: Remove the iterator_exhausted_no_error label (GH-96517)
Diffstat (limited to 'Python')
-rw-r--r-- | Python/ceval.c | 36 |
1 files changed, 20 insertions, 16 deletions
diff --git a/Python/ceval.c b/Python/ceval.c index 971f6f1..af47e09 100644 --- a/Python/ceval.c +++ b/Python/ceval.c @@ -3816,10 +3816,9 @@ handle_eval_breaker: } _PyErr_Clear(tstate); } - iterator_exhausted_no_error: /* iterator ended normally */ - assert(!_PyErr_Occurred(tstate)); - Py_DECREF(POP()); + STACK_SHRINK(1); + Py_DECREF(iter); JUMPBY(INLINE_CACHE_ENTRIES_FOR_ITER + oparg); DISPATCH(); } @@ -3845,19 +3844,21 @@ handle_eval_breaker: DEOPT_IF(Py_TYPE(it) != &PyListIter_Type, FOR_ITER); STAT_INC(FOR_ITER, hit); PyListObject *seq = it->it_seq; - if (seq == NULL) { - goto iterator_exhausted_no_error; - } - if (it->it_index < PyList_GET_SIZE(seq)) { - PyObject *next = PyList_GET_ITEM(seq, it->it_index++); - Py_INCREF(next); - PUSH(next); - JUMPBY(INLINE_CACHE_ENTRIES_FOR_ITER); - NOTRACE_DISPATCH(); + if (seq) { + if (it->it_index < PyList_GET_SIZE(seq)) { + PyObject *next = PyList_GET_ITEM(seq, it->it_index++); + Py_INCREF(next); + PUSH(next); + JUMPBY(INLINE_CACHE_ENTRIES_FOR_ITER); + NOTRACE_DISPATCH(); + } + it->it_seq = NULL; + Py_DECREF(seq); } - it->it_seq = NULL; - Py_DECREF(seq); - goto iterator_exhausted_no_error; + STACK_SHRINK(1); + Py_DECREF(it); + JUMPBY(INLINE_CACHE_ENTRIES_FOR_ITER + oparg); + NOTRACE_DISPATCH(); } TARGET(FOR_ITER_RANGE) { @@ -3868,7 +3869,10 @@ handle_eval_breaker: _Py_CODEUNIT next = next_instr[INLINE_CACHE_ENTRIES_FOR_ITER]; assert(_PyOpcode_Deopt[_Py_OPCODE(next)] == STORE_FAST); if (r->index >= r->len) { - goto iterator_exhausted_no_error; + STACK_SHRINK(1); + Py_DECREF(r); + JUMPBY(INLINE_CACHE_ENTRIES_FOR_ITER + oparg); + NOTRACE_DISPATCH(); } long value = (long)(r->start + (unsigned long)(r->index++) * r->step); |