diff --git a/Objects/abstract.c b/Objects/abstract.c index 6335aa2cae9..684b0b4abd2 100644 --- a/Objects/abstract.c +++ b/Objects/abstract.c @@ -1240,7 +1240,7 @@ PyNumber_Index(PyObject *item) return NULL; } } - else if (m && m->nb_int != NULL) { + else if (m && m->nb_int != NULL && m->nb_float == NULL) { result = m->nb_int(item); if (result && !PyLong_Check(result)) { PyErr_Format(PyExc_TypeError,