summaryrefslogtreecommitdiffstats
path: root/Objects/unicodeobject.c
diff options
context:
space:
mode:
authorGuido van Rossum <guido@python.org>2006-08-17 21:11:47 (GMT)
committerGuido van Rossum <guido@python.org>2006-08-17 21:11:47 (GMT)
commit49d6b07c6b4b16d35f160726a59de819d077ee30 (patch)
tree45686ed91cc46f46e206bb52a45d7c8abd3cf67b /Objects/unicodeobject.c
parentbf12cdbb2880eb402f65ce8d1db09caa84c6b801 (diff)
downloadcpython-49d6b07c6b4b16d35f160726a59de819d077ee30.zip
cpython-49d6b07c6b4b16d35f160726a59de819d077ee30.tar.gz
cpython-49d6b07c6b4b16d35f160726a59de819d077ee30.tar.bz2
Make the it_index field in the str/unicode iterators Py_ssize_t's.
Test the new iterators on str/unicode.
Diffstat (limited to 'Objects/unicodeobject.c')
-rw-r--r--Objects/unicodeobject.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/Objects/unicodeobject.c b/Objects/unicodeobject.c
index a87916c..e63e629 100644
--- a/Objects/unicodeobject.c
+++ b/Objects/unicodeobject.c
@@ -7969,7 +7969,7 @@ _PyUnicode_Fini(void)
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 @@ unicodeiter_next(unicodeiterobject *it)
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 @@ unicodeiter_len(unicodeiterobject *it)
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 @@ PyTypeObject PyUnicodeIter_Type = {
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 */