Commit 621cd01b authored by Michael W. Hudson's avatar Michael W. Hudson

In the process of adding all the extended slice support I attempted to

change _PyEval_SliceIndex to round massively negative longs up to
-INT_MAX, instead of 0 but botched it.  Get it right.

Thx to Armin for the report.
parent 4ea4531c
...@@ -3614,8 +3614,8 @@ _PyEval_SliceIndex(PyObject *v, int *pi) ...@@ -3614,8 +3614,8 @@ _PyEval_SliceIndex(PyObject *v, int *pi)
/* It's an overflow error, so we need to /* It's an overflow error, so we need to
check the sign of the long integer, check the sign of the long integer,
set the value to INT_MAX or 0, and clear set the value to INT_MAX or -INT_MAX,
the error. */ and clear the error. */
/* Create a long integer with a value of 0 */ /* Create a long integer with a value of 0 */
long_zero = PyLong_FromLong(0L); long_zero = PyLong_FromLong(0L);
...@@ -3628,10 +3628,10 @@ _PyEval_SliceIndex(PyObject *v, int *pi) ...@@ -3628,10 +3628,10 @@ _PyEval_SliceIndex(PyObject *v, int *pi)
Py_DECREF(long_zero); Py_DECREF(long_zero);
if (cmp < 0) if (cmp < 0)
return 0; return 0;
else if (cmp > 0) else if (cmp)
x = INT_MAX; x = INT_MAX;
else else
x = 0; x = -INT_MAX;
} }
} else { } else {
PyErr_SetString(PyExc_TypeError, PyErr_SetString(PyExc_TypeError,
......
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