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``.
This commit is contained in:
parent
261cfedf76
commit
1d3dad5f96
|
@ -0,0 +1,2 @@
|
||||||
|
Fix integer overflow in the :meth:`array.array.index` method on 64-bit Windows
|
||||||
|
for index larger than ``2**31``.
|
|
@ -1130,7 +1130,7 @@ array_array_index(arrayobject *self, PyObject *v)
|
||||||
cmp = PyObject_RichCompareBool(selfi, v, Py_EQ);
|
cmp = PyObject_RichCompareBool(selfi, v, Py_EQ);
|
||||||
Py_DECREF(selfi);
|
Py_DECREF(selfi);
|
||||||
if (cmp > 0) {
|
if (cmp > 0) {
|
||||||
return PyLong_FromLong((long)i);
|
return PyLong_FromSsize_t(i);
|
||||||
}
|
}
|
||||||
else if (cmp < 0)
|
else if (cmp < 0)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
Loading…
Reference in New Issue