[Python-checkins] r43583 - python/trunk/Objects/sliceobject.c
martin.v.loewis
python-checkins at python.org
Mon Apr 3 13:38:08 CEST 2006
Author: martin.v.loewis
Date: Mon Apr 3 13:38:08 2006
New Revision: 43583
Modified:
python/trunk/Objects/sliceobject.c
Log:
Allow long integers in PySlice_GetIndices.
Modified: python/trunk/Objects/sliceobject.c
==============================================================================
--- python/trunk/Objects/sliceobject.c (original)
+++ python/trunk/Objects/sliceobject.c Mon Apr 3 13:38:08 2006
@@ -106,20 +106,20 @@
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;
}
More information about the Python-checkins
mailing list