Mercurial > cpython-lru_cache-weakref
diff Objects/unicodeobject.c @ 39544:01034018e8b2
Make the it_index field in the str/unicode iterators Py_ssize_t's.
Test the new iterators on str/unicode.
| author | Guido van Rossum <guido@python.org> |
|---|---|
| date | Thu, 17 Aug 2006 21:11:47 +0000 |
| parents | 8f5b9982beba |
| children | 3674f20ac781 |
line wrap: on
line diff
--- a/Objects/unicodeobject.c Thu Aug 17 20:24:18 2006 +0000 +++ b/Objects/unicodeobject.c Thu Aug 17 21:11:47 2006 +0000 @@ -7969,7 +7969,7 @@ typedef struct { PyObject_HEAD - long it_index; + Py_ssize_t it_index; PyUnicodeObject *it_seq; /* Set to NULL when iterator is exhausted */ } unicodeiterobject; @@ -8001,7 +8001,8 @@ assert(PyUnicode_Check(seq)); if (it->it_index < PyUnicode_GET_SIZE(seq)) { - item = PyUnicode_FromUnicode(PyUnicode_AS_UNICODE(seq)+it->it_index, 1); + item = PyUnicode_FromUnicode( + PyUnicode_AS_UNICODE(seq)+it->it_index, 1); if (item != NULL) ++it->it_index; return item; @@ -8024,7 +8025,8 @@ PyDoc_STRVAR(length_hint_doc, "Private method returning an estimate of len(list(it))."); static PyMethodDef unicodeiter_methods[] = { - {"__length_hint__", (PyCFunction)unicodeiter_len, METH_NOARGS, length_hint_doc}, + {"__length_hint__", (PyCFunction)unicodeiter_len, METH_NOARGS, + length_hint_doc}, {NULL, NULL} /* sentinel */ }; @@ -8035,7 +8037,7 @@ sizeof(unicodeiterobject), /* tp_basicsize */ 0, /* tp_itemsize */ /* methods */ - (destructor)unicodeiter_dealloc, /* tp_dealloc */ + (destructor)unicodeiter_dealloc, /* tp_dealloc */ 0, /* tp_print */ 0, /* tp_getattr */ 0, /* tp_setattr */
