Return ints instead of longs for tuple.count() and tuple.index().
This commit is contained in:
parent
00c2e65850
commit
55285ef44c
|
@ -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
|
||||||
|
|
Loading…
Reference in New Issue