Skip to content

Commit a5955b0

Browse files
miss-islingtonsth
andauthored
closes bpo-35623: Fix integer overflow when sorting large lists (GH-11380)
There is already a `Py_ssize_t i` defined at function scope that is used for similar loops. By removing the local `int i` declaration that `i` is used, which has the appropriate type. (cherry picked from commit f8b5344) Co-authored-by: sth <[email protected]>
1 parent 513fab2 commit a5955b0

File tree

2 files changed

+1
-1
lines changed

2 files changed

+1
-1
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Fix a crash when sorting very long lists. Patch by Stephan Hohe.

Objects/listobject.c

-1
Original file line numberDiff line numberDiff line change
@@ -2232,7 +2232,6 @@ list_sort_impl(PyListObject *self, PyObject *keyfunc, int reverse)
22322232
int ints_are_bounded = 1;
22332233

22342234
/* Prove that assumption by checking every key. */
2235-
int i;
22362235
for (i=0; i < saved_ob_size; i++) {
22372236

22382237
if (keys_are_in_tuples &&

0 commit comments

Comments
 (0)