Handle really big steps in extended slices.

Fixes a test failure on 64 bit platforms (I hope).
This commit is contained in:
Michael W. Hudson 2002-11-06 15:17:32 +00:00
parent 9050a517c8
commit cbd6fb9006
2 changed files with 3 additions and 6 deletions

View File

@ -121,11 +121,8 @@ PySlice_GetIndicesEx(PySliceObject *r, int length,
*step = 1;
}
else {
*step = PyInt_AsLong(r->step);
if (*step == -1 && PyErr_Occurred()) {
return -1;
}
else if (*step == 0) {
if (!_PyEval_SliceIndex(r->step, step)) return -1;
if (*step == 0) {
PyErr_SetString(PyExc_ValueError,
"slice step cannot be zero");
return -1;

View File

@ -3507,7 +3507,7 @@ _PyEval_SliceIndex(PyObject *v, int *pi)
if (x > INT_MAX)
x = INT_MAX;
else if (x < -INT_MAX)
x = 0;
x = -INT_MAX;
*pi = x;
}
return 1;