summaryrefslogtreecommitdiffstats
path: root/Objects
diff options
context:
space:
mode:
Diffstat (limited to 'Objects')
-rw-r--r--Objects/abstract.c16
1 files changed, 2 insertions, 14 deletions
diff --git a/Objects/abstract.c b/Objects/abstract.c
index 684b0b4..dac80d9 100644
--- a/Objects/abstract.c
+++ b/Objects/abstract.c
@@ -1220,7 +1220,6 @@ PyNumber_Absolute(PyObject *o)
PyObject *
PyNumber_Index(PyObject *item)
{
- PyNumberMethods *m;
PyObject *result = NULL;
if (item == NULL)
return null_error();
@@ -1228,9 +1227,8 @@ PyNumber_Index(PyObject *item)
Py_INCREF(item);
return item;
}
- m = item->ob_type->tp_as_number;
if (PyIndex_Check(item)) {
- result = m->nb_index(item);
+ result = item->ob_type->tp_as_number->nb_index(item);
if (result && !PyLong_Check(result)) {
PyErr_Format(PyExc_TypeError,
"__index__ returned non-int "
@@ -1240,17 +1238,7 @@ PyNumber_Index(PyObject *item)
return 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,
- "__int__ returned non-int "
- "(type %.200s)",
- result->ob_type->tp_name);
- Py_DECREF(result);
- return NULL;
- }
- } else {
+ else {
PyErr_Format(PyExc_TypeError,
"'%.200s' object cannot be interpreted "
"as an integer", item->ob_type->tp_name);