Commit b4faaed7 authored by Michael W. Hudson's avatar Michael W. Hudson

Handle really big steps in extended slices.

Fixes a test failure on 64 bit platforms (I hope).
parent dd0dbf32
...@@ -121,11 +121,8 @@ PySlice_GetIndicesEx(PySliceObject *r, int length, ...@@ -121,11 +121,8 @@ PySlice_GetIndicesEx(PySliceObject *r, int length,
*step = 1; *step = 1;
} }
else { else {
*step = PyInt_AsLong(r->step); if (!_PyEval_SliceIndex(r->step, step)) return -1;
if (*step == -1 && PyErr_Occurred()) { if (*step == 0) {
return -1;
}
else if (*step == 0) {
PyErr_SetString(PyExc_ValueError, PyErr_SetString(PyExc_ValueError,
"slice step cannot be zero"); "slice step cannot be zero");
return -1; return -1;
......
...@@ -3507,7 +3507,7 @@ _PyEval_SliceIndex(PyObject *v, int *pi) ...@@ -3507,7 +3507,7 @@ _PyEval_SliceIndex(PyObject *v, int *pi)
if (x > INT_MAX) if (x > INT_MAX)
x = INT_MAX; x = INT_MAX;
else if (x < -INT_MAX) else if (x < -INT_MAX)
x = 0; x = -INT_MAX;
*pi = x; *pi = x;
} }
return 1; return 1;
......
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