]> granicus.if.org Git - python/commitdiff
In the process of adding all the extended slice support I attempted to
authorMichael W. Hudson <mwh@python.net>
Thu, 27 Feb 2003 14:50:34 +0000 (14:50 +0000)
committerMichael W. Hudson <mwh@python.net>
Thu, 27 Feb 2003 14:50:34 +0000 (14:50 +0000)
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.

Python/ceval.c

index 5286d25605d32eafdcaa96f243668202e7b288b9..8c246f6a07b72e1368aadbfb7ed680b26cc6ad9b 100644 (file)
@@ -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,