diff options
author | Martin v. Löwis <martin@v.loewis.de> | 2006-04-03 11:38:08 +0000 |
---|---|---|
committer | Martin v. Löwis <martin@v.loewis.de> | 2006-04-03 11:38:08 +0000 |
commit | 54b42f185ea64dc06649d07bb1592d94bb379935 (patch) | |
tree | 76c740001ec18ef921c91fd8341316b9995d52fa /Objects/sliceobject.c | |
parent | Add test case for #43581. (diff) | |
download | cpython-54b42f185ea64dc06649d07bb1592d94bb379935.tar.gz cpython-54b42f185ea64dc06649d07bb1592d94bb379935.tar.bz2 cpython-54b42f185ea64dc06649d07bb1592d94bb379935.zip |
Allow long integers in PySlice_GetIndices.
Diffstat (limited to 'Objects/sliceobject.c')
-rw-r--r-- | Objects/sliceobject.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/Objects/sliceobject.c b/Objects/sliceobject.c index e33261b8148..271a9ad62d2 100644 --- a/Objects/sliceobject.c +++ b/Objects/sliceobject.c @@ -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; } |