Skip to content

Commit 92f8b48

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 cd69620 commit 92f8b48

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
@@ -1141,7 +1141,7 @@ array_array_index(arrayobject *self, PyObject *v)
11411141
cmp = PyObject_RichCompareBool(selfi, v, Py_EQ);
11421142
Py_DECREF(selfi);
11431143
if (cmp > 0) {
1144-
return PyLong_FromLong((long)i);
1144+
return PyLong_FromSsize_t(i);
11451145
}
11461146
else if (cmp < 0)
11471147
return NULL;

0 commit comments

Comments
 (0)