Created PyObject_GenericGetIter().

Factors out the common case of returning self.
This commit is contained in:
Raymond Hettinger 2003-03-17 08:24:35 +00:00
parent 08801db123
commit 0153826964
10 changed files with 30 additions and 147 deletions

View file

@ -779,14 +779,6 @@ tupleiter_traverse(tupleiterobject *it, visitproc visit, void *arg)
return visit((PyObject *)it->it_seq, arg);
}
static PyObject *
tupleiter_getiter(PyObject *it)
{
Py_INCREF(it);
return it;
}
static PyObject *
tupleiter_next(tupleiterobject *it)
{
@ -839,6 +831,6 @@ PyTypeObject PyTupleIter_Type = {
0, /* tp_clear */
0, /* tp_richcompare */
0, /* tp_weaklistoffset */
(getiterfunc)tupleiter_getiter, /* tp_iter */
PyObject_GenericGetIter, /* tp_iter */
(iternextfunc)tupleiter_next, /* tp_iternext */
};