mirror of
https://github.com/python/cpython.git
synced 2025-09-27 10:50:04 +00:00
Return ints instead of longs for tuple.count() and tuple.index().
This commit is contained in:
parent
00c2e65850
commit
55285ef44c
1 changed files with 2 additions and 2 deletions
|
@ -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…
Add table
Add a link
Reference in a new issue