[3.13] gh-126595: fix a crash when calling itertools.count(sys.maxsize) (GH-126617) (#126739)

gh-126595: fix a crash when calling `itertools.count(sys.maxsize)` (GH-126617)
(cherry picked from commit 6e3bb8a913)

Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com>
This commit is contained in:
Miss Islington (bot) 2024-11-12 15:14:21 +01:00 committed by GitHub
parent 2da063e0b2
commit 865f096f51
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 13 additions and 0 deletions

View file

@ -4075,6 +4075,9 @@ itertools_count_impl(PyTypeObject *type, PyObject *long_cnt,
PyErr_Clear();
fast_mode = 0;
}
else if (cnt == PY_SSIZE_T_MAX) {
fast_mode = 0;
}
}
} else {
cnt = 0;