summaryrefslogtreecommitdiffstats
path: root/Objects/iterobject.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/iterobject.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/iterobject.c')
-rw-r--r--Objects/iterobject.c11
1 files changed, 2 insertions, 9 deletions
diff --git a/Objects/iterobject.c b/Objects/iterobject.c
index 2e1caae..7970fa6 100644
--- a/Objects/iterobject.c
+++ b/Objects/iterobject.c
@@ -44,13 +44,6 @@ iter_traverse(seqiterobject *it, visitproc visit, void *arg)
}
static PyObject *
-iter_getiter(PyObject *it)
-{
- Py_INCREF(it);
- return it;
-}
-
-static PyObject *
iter_iternext(PyObject *iterator)
{
seqiterobject *it;
@@ -106,7 +99,7 @@ PyTypeObject PySeqIter_Type = {
0, /* tp_clear */
0, /* tp_richcompare */
0, /* tp_weaklistoffset */
- (getiterfunc)iter_getiter, /* tp_iter */
+ PyObject_GenericGetIter, /* tp_iter */
(iternextfunc)iter_iternext, /* tp_iternext */
0, /* tp_methods */
0, /* tp_members */
@@ -223,7 +216,7 @@ PyTypeObject PyCallIter_Type = {
0, /* tp_clear */
0, /* tp_richcompare */
0, /* tp_weaklistoffset */
- (getiterfunc)iter_getiter, /* tp_iter */
+ PyObject_GenericGetIter, /* tp_iter */
(iternextfunc)calliter_iternext, /* tp_iternext */
0, /* tp_methods */
0, /* tp_members */