Trent Mick:

Change static slice_index() to extern _PyEval_SliceIndex() (with
different return value interpretation: 0 for failure, 1 for success).
diff --git a/Python/ceval.c b/Python/ceval.c
index 46c3e00..78196ba 100644
--- a/Python/ceval.c
+++ b/Python/ceval.c
@@ -80,7 +80,6 @@
 static PyObject *call_builtin Py_PROTO((PyObject *, PyObject *, PyObject *));
 static PyObject *call_function Py_PROTO((PyObject *, PyObject *, PyObject *));
 static PyObject *loop_subscript Py_PROTO((PyObject *, PyObject *));
-static int slice_index Py_PROTO((PyObject *, int *));
 static PyObject *apply_slice Py_PROTO((PyObject *, PyObject *, PyObject *));
 static int assign_slice Py_PROTO((PyObject *, PyObject *,
 				  PyObject *, PyObject *));
@@ -2587,8 +2586,12 @@
 	return NULL;
 }
 
-static int
-slice_index(v, pi)
+/* Extract a slice index from a PyInt or PyLong, the index is bound to
+   the range [-INT_MAX+1, INTMAX]. Returns 0 and an exception if there is
+   and error. Returns 1 on success.*/
+
+int
+_PyEval_SliceIndex(v, pi)
 	PyObject *v;
 	int *pi;
 {
@@ -2604,7 +2607,7 @@
 				if (!PyErr_ExceptionMatches( PyExc_OverflowError ) ) {
 					/* It's not an overflow error, so just 
 					   signal an error */
-					return -1;
+					return 0;
 				}
 
 				/* It's an overflow error, so we need to 
@@ -2614,7 +2617,7 @@
 
 				/* Create a long integer with a value of 0 */
 				long_zero = PyLong_FromLong( 0L );
-				if (long_zero == NULL) return -1;
+				if (long_zero == NULL) return 0;
 
 				/* Check sign */
 				if (PyObject_Compare(long_zero, v) < 0)
@@ -2630,7 +2633,7 @@
 		} else {
 			PyErr_SetString(PyExc_TypeError,
 					"slice index must be int");
-			return -1;
+			return 0;
 		}
 		/* Truncate -- very long indices are truncated anyway */
 		if (x > INT_MAX)
@@ -2639,7 +2642,7 @@
 			x = 0;
 		*pi = x;
 	}
-	return 0;
+	return 1;
 }
 
 static PyObject *
@@ -2647,9 +2650,9 @@
 	PyObject *u, *v, *w;
 {
 	int ilow = 0, ihigh = INT_MAX;
-	if (slice_index(v, &ilow) != 0)
+	if (!_PyEval_SliceIndex(v, &ilow))
 		return NULL;
-	if (slice_index(w, &ihigh) != 0)
+	if (!_PyEval_SliceIndex(w, &ihigh))
 		return NULL;
 	return PySequence_GetSlice(u, ilow, ihigh);
 }
@@ -2659,9 +2662,9 @@
 	PyObject *u, *v, *w, *x;
 {
 	int ilow = 0, ihigh = INT_MAX;
-	if (slice_index(v, &ilow) != 0)
+	if (!_PyEval_SliceIndex(v, &ilow))
 		return -1;
-	if (slice_index(w, &ihigh) != 0)
+	if (!_PyEval_SliceIndex(w, &ihigh))
 		return -1;
 	if (x == NULL)
 		return PySequence_DelSlice(u, ilow, ihigh);