Message 104747 - Python tracker (original) (raw)
Alexander, I think it should be as simple as replacing the if (!PyInt_Check(ilow) && ...) block with something like this:
if (!PyInt_Check(ilow) && !PyLong_Check(ilow)) {
PyNumberMethods *nb = Py_TYPE(ilow)->tp_as_number;
PyObject *temp;
if (PyFloat_Check(ilow) || nb == NULL || nb->nb_int == NULL) {
PyErr_Format(PyExc_TypeError,
"range() integer start argument expected, got %s.",
ilow->ob_type->tp_name);
goto Fail;
}
temp = (*nb->nb_int)(ilow);
Py_DECREF(ilow);
ilow = temp;
if (temp == NULL)
goto Fail;
}
and then doing the same for the ihigh and istep blocks. But I haven't tested this.
Mark