summaryrefslogtreecommitdiffstats
path: root/Python/ceval.c
diff options
context:
space:
mode:
authorMichael W. Hudson <mwh@python.net>2003-02-27 14:50:34 (GMT)
committerMichael W. Hudson <mwh@python.net>2003-02-27 14:50:34 (GMT)
commite46d1559c95f018a3e92c35d0e35768774a0f2fe (patch)
tree94e41bf02a50848f8dea0e2bc835a9aabf0fdb1c /Python/ceval.c
parentce56c377a0f548cdac3ab9c66117df654f934484 (diff)
downloadcpython-e46d1559c95f018a3e92c35d0e35768774a0f2fe.zip
cpython-e46d1559c95f018a3e92c35d0e35768774a0f2fe.tar.gz
cpython-e46d1559c95f018a3e92c35d0e35768774a0f2fe.tar.bz2
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.
Diffstat (limited to 'Python/ceval.c')
-rw-r--r--Python/ceval.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/Python/ceval.c b/Python/ceval.c
index 5286d25..8c246f6 100644
--- a/Python/ceval.c
+++ b/Python/ceval.c
@@ -3614,8 +3614,8 @@ _PyEval_SliceIndex(PyObject *v, int *pi)
/* It's an overflow error, so we need to
check the sign of the long integer,
- set the value to INT_MAX or 0, and clear
- the error. */
+ set the value to INT_MAX or -INT_MAX,
+ and clear the error. */
/* Create a long integer with a value of 0 */
long_zero = PyLong_FromLong(0L);
@@ -3628,10 +3628,10 @@ _PyEval_SliceIndex(PyObject *v, int *pi)
Py_DECREF(long_zero);
if (cmp < 0)
return 0;
- else if (cmp > 0)
+ else if (cmp)
x = INT_MAX;
else
- x = 0;
+ x = -INT_MAX;
}
} else {
PyErr_SetString(PyExc_TypeError,