gh-115733: Fix crash involving exhausted list iterator (#115740)

* gh-115733: Fix crash involving exhausted iterator

* Add blurb
This commit is contained in:
Sam Gross 2024-02-20 15:18:44 -05:00 committed by GitHub
parent 494739e1f7
commit 520403ed4c
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
6 changed files with 13 additions and 5 deletions

View file

@ -2427,6 +2427,7 @@
_PyListIterObject *it = (_PyListIterObject *)iter;
assert(Py_TYPE(iter) == &PyListIter_Type);
PyListObject *seq = it->it_seq;
if (seq == NULL) goto deoptimize;
if ((size_t)it->it_index >= (size_t)PyList_GET_SIZE(seq)) goto deoptimize;
break;
}