summaryrefslogtreecommitdiffstats
path: root/Objects/tupleobject.c
diff options
context:
space:
mode:
Diffstat (limited to 'Objects/tupleobject.c')
-rw-r--r--Objects/tupleobject.c5
1 files changed, 2 insertions, 3 deletions
diff --git a/Objects/tupleobject.c b/Objects/tupleobject.c
index 53afab5..6f3711f 100644
--- a/Objects/tupleobject.c
+++ b/Objects/tupleobject.c
@@ -580,9 +580,8 @@ static PySequenceMethods tuple_as_sequence = {
static PyObject*
tuplesubscript(PyTupleObject* self, PyObject* item)
{
- PyNumberMethods *nb = item->ob_type->tp_as_number;
- if (nb != NULL && nb->nb_index != NULL) {
- Py_ssize_t i = nb->nb_index(item);
+ if (PyIndex_Check(item)) {
+ Py_ssize_t i = PyNumber_AsSsize_t(item, PyExc_IndexError);
if (i == -1 && PyErr_Occurred())
return NULL;
if (i < 0)