Return ints instead of longs for tuple.count() and tuple.index().

This commit is contained in:
Raymond Hettinger 2008-02-07 02:12:52 +00:00
parent 00c2e65850
commit 55285ef44c
1 changed files with 2 additions and 2 deletions

View File

@ -478,7 +478,7 @@ tupleindex(PyTupleObject *self, PyObject *args)
for (i = start; i < stop && i < Py_SIZE(self); i++) { for (i = start; i < stop && i < Py_SIZE(self); i++) {
int cmp = PyObject_RichCompareBool(self->ob_item[i], v, Py_EQ); int cmp = PyObject_RichCompareBool(self->ob_item[i], v, Py_EQ);
if (cmp > 0) if (cmp > 0)
return PyLong_FromSsize_t(i); return PyInt_FromSsize_t(i);
else if (cmp < 0) else if (cmp < 0)
return NULL; return NULL;
} }
@ -499,7 +499,7 @@ tuplecount(PyTupleObject *self, PyObject *v)
else if (cmp < 0) else if (cmp < 0)
return NULL; return NULL;
} }
return PyLong_FromSsize_t(count); return PyInt_FromSsize_t(count);
} }
static int static int