mirror of
https://github.com/python/cpython.git
synced 2025-08-22 17:55:18 +00:00
GH-121012: Set index to -1 when list iterators become exhausted in tier 2 (GH-121483)
This commit is contained in:
parent
d69529d31c
commit
8ad6067bd4
4 changed files with 20 additions and 3 deletions
|
@ -2967,7 +2967,10 @@ dummy_func(
|
|||
assert(Py_TYPE(iter_o) == &PyListIter_Type);
|
||||
PyListObject *seq = it->it_seq;
|
||||
EXIT_IF(seq == NULL);
|
||||
EXIT_IF((size_t)it->it_index >= (size_t)PyList_GET_SIZE(seq));
|
||||
if ((size_t)it->it_index >= (size_t)PyList_GET_SIZE(seq)) {
|
||||
it->it_index = -1;
|
||||
EXIT_IF(1);
|
||||
}
|
||||
}
|
||||
|
||||
op(_ITER_NEXT_LIST, (iter -- iter, next)) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue