summaryrefslogtreecommitdiffstats
path: root/Objects/rangeobject.c
diff options
context:
space:
mode:
authorRaymond Hettinger <python@rcn.com>2003-03-17 08:24:35 (GMT)
committerRaymond Hettinger <python@rcn.com>2003-03-17 08:24:35 (GMT)
commit01538269643175877f516d09f429a2ae28136da6 (patch)
tree3b6bdbf815394deaf883b1409de3520de88959b4 /Objects/rangeobject.c
parent08801db123077407ae7ec7af2fe2d65a24a46063 (diff)
downloadcpython-01538269643175877f516d09f429a2ae28136da6.zip
cpython-01538269643175877f516d09f429a2ae28136da6.tar.gz
cpython-01538269643175877f516d09f429a2ae28136da6.tar.bz2
Created PyObject_GenericGetIter().
Factors out the common case of returning self.
Diffstat (limited to 'Objects/rangeobject.c')
-rw-r--r--Objects/rangeobject.c9
1 files changed, 1 insertions, 8 deletions
diff --git a/Objects/rangeobject.c b/Objects/rangeobject.c
index 9c7b74e..5dbbf13 100644
--- a/Objects/rangeobject.c
+++ b/Objects/rangeobject.c
@@ -246,13 +246,6 @@ range_iter(PyObject *seq)
}
static PyObject *
-rangeiter_getiter(PyObject *it)
-{
- Py_INCREF(it);
- return it;
-}
-
-static PyObject *
rangeiter_next(rangeiterobject *r)
{
if (r->index < r->len)
@@ -288,7 +281,7 @@ static PyTypeObject Pyrangeiter_Type = {
0, /* tp_clear */
0, /* tp_richcompare */
0, /* tp_weaklistoffset */
- (getiterfunc)rangeiter_getiter, /* tp_iter */
+ PyObject_GenericGetIter, /* tp_iter */
(iternextfunc)rangeiter_next, /* tp_iternext */
0, /* tp_methods */
};