summaryrefslogtreecommitdiffstats
path: root/Python/generated_cases.c.h
diff options
context:
space:
mode:
authorSam Gross <colesbury@gmail.com>2024-02-20 20:18:44 (GMT)
committerGitHub <noreply@github.com>2024-02-20 20:18:44 (GMT)
commit520403ed4cdf4890d63403c9cf01ac63233f5ef4 (patch)
tree5a51e71547cbe711d8e067cdc65bb3fa1631e626 /Python/generated_cases.c.h
parent494739e1f71f8e290a2c869d4f40f4ea36a045c2 (diff)
downloadcpython-520403ed4cdf4890d63403c9cf01ac63233f5ef4.zip
cpython-520403ed4cdf4890d63403c9cf01ac63233f5ef4.tar.gz
cpython-520403ed4cdf4890d63403c9cf01ac63233f5ef4.tar.bz2
gh-115733: Fix crash involving exhausted list iterator (#115740)
* gh-115733: Fix crash involving exhausted iterator * Add blurb
Diffstat (limited to 'Python/generated_cases.c.h')
-rw-r--r--Python/generated_cases.c.h2
1 files changed, 1 insertions, 1 deletions
diff --git a/Python/generated_cases.c.h b/Python/generated_cases.c.h
index 01e67ac..7f46bc8 100644
--- a/Python/generated_cases.c.h
+++ b/Python/generated_cases.c.h
@@ -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) {