diff options
Diffstat (limited to 'Objects/tupleobject.c')
-rw-r--r-- | Objects/tupleobject.c | 7 |
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))."); |