diff options
Diffstat (limited to 'Objects/tupleobject.c')
-rw-r--r-- | Objects/tupleobject.c | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/Objects/tupleobject.c b/Objects/tupleobject.c index ec3f91b..52896b7 100644 --- a/Objects/tupleobject.c +++ b/Objects/tupleobject.c @@ -322,6 +322,9 @@ error: 1082527, 1165049, 1082531, 1165057, 1247581, 1330103, 1082533, 1330111, 1412633, 1165069, 1247599, 1495177, 1577699 + + Tests have shown that it's not worth to cache the hash value, see + issue #9685. */ static Py_hash_t @@ -927,7 +930,7 @@ PyTuple_Fini(void) typedef struct { PyObject_HEAD - long it_index; + Py_ssize_t it_index; PyTupleObject *it_seq; /* Set to NULL when iterator is exhausted */ } tupleiterobject; @@ -985,7 +988,7 @@ static PyObject * tupleiter_reduce(tupleiterobject *it) { if (it->it_seq) - return Py_BuildValue("N(O)l", _PyObject_GetBuiltin("iter"), + return Py_BuildValue("N(O)n", _PyObject_GetBuiltin("iter"), it->it_seq, it->it_index); else return Py_BuildValue("N(())", _PyObject_GetBuiltin("iter")); @@ -994,7 +997,7 @@ tupleiter_reduce(tupleiterobject *it) static PyObject * tupleiter_setstate(tupleiterobject *it, PyObject *state) { - long index = PyLong_AsLong(state); + Py_ssize_t index = PyLong_AsSsize_t(state); if (index == -1 && PyErr_Occurred()) return NULL; if (it->it_seq != NULL) { |