summaryrefslogtreecommitdiffstats
path: root/Python/generated_cases.c.h
diff options
context:
space:
mode:
Diffstat (limited to 'Python/generated_cases.c.h')
-rw-r--r--Python/generated_cases.c.h5
1 files changed, 4 insertions, 1 deletions
diff --git a/Python/generated_cases.c.h b/Python/generated_cases.c.h
index a49223e..177bc32 100644
--- a/Python/generated_cases.c.h
+++ b/Python/generated_cases.c.h
@@ -2541,11 +2541,14 @@
assert(Py_TYPE(iter) == &PyListIter_Type);
STAT_INC(FOR_ITER, hit);
PyListObject *seq = it->it_seq;
- if (seq == NULL || it->it_index >= PyList_GET_SIZE(seq)) {
+ if ((size_t)it->it_index >= (size_t)PyList_GET_SIZE(seq)) {
+ it->it_index = -1;
+ #ifndef Py_GIL_DISABLED
if (seq != NULL) {
it->it_seq = NULL;
Py_DECREF(seq);
}
+ #endif
Py_DECREF(iter);
STACK_SHRINK(1);
/* Jump forward oparg, then skip following END_FOR and POP_TOP instructions */