STINNER Victor <[email protected]> added the comment:
That's a bug in array_array_index() which downcasts "Py_ssize_t i" to long:
static PyObject *
array_array_index(arrayobject *self, PyObject *v)
/*[clinic end generated code: output=d48498d325602167 input=cf619898c6649d08]*/
{
Py_ssize_t i;
for (i = 0; i < Py_SIZE(self); i++) {
PyObject *selfi;
int cmp;
selfi = getarrayitem((PyObject *)self, i);
if (selfi == NULL)
return NULL;
cmp = PyObject_RichCompareBool(selfi, v, Py_EQ);
Py_DECREF(selfi);
if (cmp > 0) {
return PyLong_FromLong((long)i); // <===== HERE ===
}
else if (cmp < 0)
return NULL;
}
PyErr_SetString(PyExc_ValueError, "array.index(x): x not in array");
return NULL;
}
----------
_______________________________________
Python tracker <[email protected]>
<https://bugs.python.org/issue41085>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe:
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com