Kaydet (Commit) 54b42f18 authored tarafından Martin v. Löwis's avatar Martin v. Löwis

Allow long integers in PySlice_GetIndices.

üst a8cd7a26
......@@ -106,20 +106,20 @@ PySlice_GetIndices(PySliceObject *r, Py_ssize_t length,
if (r->step == Py_None) {
*step = 1;
} else {
if (!PyInt_Check(r->step)) return -1;
if (!PyInt_Check(r->step) && !PyLong_Check(r->step)) return -1;
*step = PyInt_AsSsize_t(r->step);
}
if (r->start == Py_None) {
*start = *step < 0 ? length-1 : 0;
} else {
if (!PyInt_Check(r->start)) return -1;
if (!PyInt_Check(r->start) && !PyLong_Check(r->step)) return -1;
*start = PyInt_AsSsize_t(r->start);
if (*start < 0) *start += length;
}
if (r->stop == Py_None) {
*stop = *step < 0 ? -1 : length;
} else {
if (!PyInt_Check(r->stop)) return -1;
if (!PyInt_Check(r->stop) && !PyLong_Check(r->step)) return -1;
*stop = PyInt_AsSsize_t(r->stop);
if (*stop < 0) *stop += length;
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment