mirror of
https://github.com/python/cpython.git
synced 2025-10-09 08:31:26 +00:00
Use Py_ssize_t for counts and sizes.
Convert Py_ssize_t using PyInt_FromSsize_t
This commit is contained in:
parent
ad0a4629be
commit
eb079f1c25
10 changed files with 33 additions and 31 deletions
|
@ -159,14 +159,14 @@ PyTypeObject PyEnum_Type = {
|
|||
|
||||
typedef struct {
|
||||
PyObject_HEAD
|
||||
long index;
|
||||
Py_ssize_t index;
|
||||
PyObject* seq;
|
||||
} reversedobject;
|
||||
|
||||
static PyObject *
|
||||
reversed_new(PyTypeObject *type, PyObject *args, PyObject *kwds)
|
||||
{
|
||||
long n;
|
||||
Py_ssize_t n;
|
||||
PyObject *seq;
|
||||
reversedobject *ro;
|
||||
|
||||
|
@ -249,7 +249,7 @@ reversed_len(reversedobject *ro)
|
|||
if (seqsize == -1)
|
||||
return NULL;
|
||||
position = ro->index + 1;
|
||||
return PyInt_FromLong((seqsize < position) ? 0 : position);
|
||||
return PyInt_FromSsize_t((seqsize < position) ? 0 : position);
|
||||
}
|
||||
|
||||
PyDoc_STRVAR(length_hint_doc, "Private method returning an estimate of len(list(it)).");
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue