Skip to content

Commit c6e24e7

Browse files
bpo-41085: Fix array.array.index() on 64-bit Windows (GH-21071)
Fix integer overflow in the :meth:`array.array.index` method on 64-bit Windows for index larger than ``2**31``. (cherry picked from commit 1d3dad5) Co-authored-by: WildCard65 <[email protected]>
1 parent 56d25ad commit c6e24e7

File tree

2 files changed

+3
-1
lines changed

2 files changed

+3
-1
lines changed
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
Fix integer overflow in the :meth:`array.array.index` method on 64-bit Windows
2+
for index larger than ``2**31``.

Modules/arraymodule.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1136,7 +1136,7 @@ array_array_index(arrayobject *self, PyObject *v)
11361136
cmp = PyObject_RichCompareBool(selfi, v, Py_EQ);
11371137
Py_DECREF(selfi);
11381138
if (cmp > 0) {
1139-
return PyLong_FromLong((long)i);
1139+
return PyLong_FromSsize_t(i);
11401140
}
11411141
else if (cmp < 0)
11421142
return NULL;

0 commit comments

Comments
 (0)