Skip to content

Commit 1d3dad5

Browse files
authored
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``.
1 parent 261cfed commit 1d3dad5

File tree

2 files changed

+3
-1
lines changed

2 files changed

+3
-1
lines changed
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

+1-1
Original file line numberDiff line numberDiff line change
@@ -1130,7 +1130,7 @@ array_array_index(arrayobject *self, PyObject *v)
11301130
cmp = PyObject_RichCompareBool(selfi, v, Py_EQ);
11311131
Py_DECREF(selfi);
11321132
if (cmp > 0) {
1133-
return PyLong_FromLong((long)i);
1133+
return PyLong_FromSsize_t(i);
11341134
}
11351135
else if (cmp < 0)
11361136
return NULL;

0 commit comments

Comments
 (0)