Checking in the code for PEP 357.
This was mostly written by Travis Oliphant.
I've inspected it all; Neal Norwitz and MvL have also looked at it
(in an earlier incarnation).
diff --git a/Modules/arraymodule.c b/Modules/arraymodule.c
index 2318739..1650ff2 100644
--- a/Modules/arraymodule.c
+++ b/Modules/arraymodule.c
@@ -1569,19 +1569,17 @@
 	return s;
 }
 
+#define HASINDEX(o) PyType_HasFeature((o)->ob_type, Py_TPFLAGS_HAVE_INDEX)
+
 static PyObject*
 array_subscr(arrayobject* self, PyObject* item)
 {
-	if (PyInt_Check(item)) {
-		Py_ssize_t i = PyInt_AS_LONG(item);
-		if (i < 0)
-			i += self->ob_size;
-		return array_item(self, i);
-	}
-	else if (PyLong_Check(item)) {
-		Py_ssize_t i = PyInt_AsSsize_t(item);
-		if (i == -1 && PyErr_Occurred())
+	PyNumberMethods *nb = item->ob_type->tp_as_number;
+	if (nb != NULL && HASINDEX(item) && nb->nb_index != NULL) {
+		Py_ssize_t i = nb->nb_index(item);
+		if (i==-1 && PyErr_Occurred()) {
 			return NULL;
+		}
 		if (i < 0)
 			i += self->ob_size;
 		return array_item(self, i);
@@ -1626,15 +1624,10 @@
 static int
 array_ass_subscr(arrayobject* self, PyObject* item, PyObject* value)
 {
-	if (PyInt_Check(item)) {
-		Py_ssize_t i = PyInt_AS_LONG(item);
-		if (i < 0)
-			i += self->ob_size;
-		return array_ass_item(self, i, value);
-	}
-	else if (PyLong_Check(item)) {
-		Py_ssize_t i = PyInt_AsSsize_t(item);
-		if (i == -1 && PyErr_Occurred())
+	PyNumberMethods *nb = item->ob_type->tp_as_number;
+	if (nb != NULL && HASINDEX(item) && nb->nb_index != NULL) {
+		Py_ssize_t i = nb->nb_index(item);
+		if (i==-1 && PyErr_Occurred()) 
 			return -1;
 		if (i < 0)
 			i += self->ob_size;
diff --git a/Modules/mmapmodule.c b/Modules/mmapmodule.c
index 7c3c3e4..2e34a9f 100644
--- a/Modules/mmapmodule.c
+++ b/Modules/mmapmodule.c
@@ -815,6 +815,8 @@
 };
 
 
+#define HASINDEX(o) PyType_HasFeature((o)->ob_type, Py_TPFLAGS_HAVE_INDEX)
+
 /* extract the map size from the given PyObject
 
    Returns -1 on error, with an appropriate Python exception raised. On
@@ -822,26 +824,15 @@
 static Py_ssize_t
 _GetMapSize(PyObject *o)
 {
-	if (PyInt_Check(o)) {
-		long i = PyInt_AsLong(o);
-		if (PyErr_Occurred())
+	PyNumberMethods *nb = o->ob_type->tp_as_number;
+	if (nb != NULL && HASINDEX(o) && nb->nb_index != NULL) {
+		Py_ssize_t i = nb->nb_index(o);
+		if (i==-1 && PyErr_Occurred()) 
 			return -1;
 		if (i < 0)
 			goto onnegoverflow;
-		return i;
-	}
-	else if (PyLong_Check(o)) {
-		Py_ssize_t i = PyInt_AsSsize_t(o);
-		if (PyErr_Occurred()) {
-			/* yes negative overflow is mistaken for positive overflow
-			   but not worth the trouble to check sign of 'i' */
-			if (PyErr_ExceptionMatches(PyExc_OverflowError))
-				goto onposoverflow;
-			else
-				return -1;
-		}
-		if (i < 0)
-			goto onnegoverflow;
+		if (i==PY_SSIZE_T_MAX)
+			goto onposoverflow;
 		return i;
 	}
 	else {
diff --git a/Modules/operator.c b/Modules/operator.c
index 1a2ef85..53144f1 100644
--- a/Modules/operator.c
+++ b/Modules/operator.c
@@ -130,6 +130,20 @@
 	return NULL;
 }
 
+static PyObject *
+op_index(PyObject *s, PyObject *a)
+{
+	Py_ssize_t i;
+	PyObject *a1;
+	if (!PyArg_UnpackTuple(a,"index", 1, 1, &a1))
+		return NULL;		
+	i = PyNumber_Index(a1);
+	if (i == -1 && PyErr_Occurred())
+		return NULL;
+	else
+		return PyInt_FromSsize_t(i);
+}
+
 static PyObject*
 is_(PyObject *s, PyObject *a)
 {
@@ -229,6 +243,7 @@
 
 spam1(is_, "is_(a, b) -- Same as a is b.")
 spam1(is_not, "is_not(a, b) -- Same as a is not b.")
+spam2(index, __index__, "index(a) -- Same as a.__index__()")
 spam2(add,__add__, "add(a, b) -- Same as a + b.")
 spam2(sub,__sub__, "sub(a, b) -- Same as a - b.")
 spam2(mul,__mul__, "mul(a, b) -- Same as a * b.")