mirror of
https://github.com/python/cpython.git
synced 2025-08-22 17:55:18 +00:00
gh-115733: Fix crash involving exhausted list iterator (#115740)
* gh-115733: Fix crash involving exhausted iterator * Add blurb
This commit is contained in:
parent
494739e1f7
commit
520403ed4c
6 changed files with 13 additions and 5 deletions
2
Python/generated_cases.c.h
generated
2
Python/generated_cases.c.h
generated
|
@ -2560,7 +2560,7 @@
|
|||
assert(Py_TYPE(iter) == &PyListIter_Type);
|
||||
STAT_INC(FOR_ITER, hit);
|
||||
PyListObject *seq = it->it_seq;
|
||||
if ((size_t)it->it_index >= (size_t)PyList_GET_SIZE(seq)) {
|
||||
if (seq == NULL || (size_t)it->it_index >= (size_t)PyList_GET_SIZE(seq)) {
|
||||
it->it_index = -1;
|
||||
#ifndef Py_GIL_DISABLED
|
||||
if (seq != NULL) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue