Skip to content

Commit

Permalink
bpo-41085: Fix array.array.index() on 64-bit Windows (pythonGH-21071)
Browse files Browse the repository at this point in the history
Fix integer overflow in the :meth:`array.array.index` method on 64-bit Windows
for index larger than ``2**31``.
  • Loading branch information
WildCard65 authored and fasihahmad committed Jun 29, 2020
1 parent ab9f8b9 commit a63a16b
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
@@ -0,0 +1,2 @@
Fix integer overflow in the :meth:`array.array.index` method on 64-bit Windows
for index larger than ``2**31``.
2 changes: 1 addition & 1 deletion Modules/arraymodule.c
Expand Up @@ -1130,7 +1130,7 @@ array_array_index(arrayobject *self, PyObject *v)
cmp = PyObject_RichCompareBool(selfi, v, Py_EQ);
Py_DECREF(selfi);
if (cmp > 0) {
return PyLong_FromLong((long)i);
return PyLong_FromSsize_t(i);
}
else if (cmp < 0)
return NULL;
Expand Down

0 comments on commit a63a16b

Please sign in to comment.