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 1d3dad5f96ed445b958ec53dfa0d46812f2162d9)
Co-authored-by: WildCard65 <WildCard65@users.noreply.github.com>
diff --git a/Modules/arraymodule.c b/Modules/arraymodule.c
index 732703e..724c503 100644
--- a/Modules/arraymodule.c
+++ b/Modules/arraymodule.c
@@ -1141,7 +1141,7 @@
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;