summaryrefslogtreecommitdiffstats
path: root/Objects/tupleobject.c
diff options
context:
space:
mode:
authorMartin v. Löwis <martin@v.loewis.de>2006-02-16 14:32:27 (GMT)
committerMartin v. Löwis <martin@v.loewis.de>2006-02-16 14:32:27 (GMT)
commiteb079f1c2533bcefcab3ef4c07b800e5bd37239f (patch)
tree32ce8e1eafb2e93ef977649e3cb60a3c0ec0fc00 /Objects/tupleobject.c
parentad0a4629beac0600c4c4c3167b0d68be57ca674e (diff)
downloadcpython-eb079f1c2533bcefcab3ef4c07b800e5bd37239f.zip
cpython-eb079f1c2533bcefcab3ef4c07b800e5bd37239f.tar.gz
cpython-eb079f1c2533bcefcab3ef4c07b800e5bd37239f.tar.bz2
Use Py_ssize_t for counts and sizes.
Convert Py_ssize_t using PyInt_FromSsize_t
Diffstat (limited to 'Objects/tupleobject.c')
-rw-r--r--Objects/tupleobject.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/Objects/tupleobject.c b/Objects/tupleobject.c
index 2de2899..95debbb 100644
--- a/Objects/tupleobject.c
+++ b/Objects/tupleobject.c
@@ -278,7 +278,8 @@ tuplehash(PyTupleObject *v)
if (y == -1)
return -1;
x = (x ^ y) * mult;
- mult += 82520L + len + len;
+ /* the cast might truncate len; that doesn't change hash stability */
+ mult += (long)(82520L + len + len);
}
x += 97531L;
if (x == -1)
@@ -850,10 +851,10 @@ tupleiter_next(tupleiterobject *it)
static PyObject *
tupleiter_len(tupleiterobject *it)
{
- long len = 0;
+ Py_ssize_t len = 0;
if (it->it_seq)
len = PyTuple_GET_SIZE(it->it_seq) - it->it_index;
- return PyInt_FromLong(len);
+ return PyInt_FromSsize_t(len);
}
PyDoc_STRVAR(length_hint_doc, "Private method returning an estimate of len(list(it)).");