Created PyObject_GenericGetIter().
Factors out the common case of returning self.
This commit is contained in:
parent
0153826964
commit
e0cce8f8f0
|
@ -141,13 +141,6 @@ logreader_fileno(LogReaderObject *self)
|
|||
return PyInt_FromLong(fileno(self->logfp));
|
||||
}
|
||||
|
||||
static PyObject *
|
||||
logreader_tp_iter(LogReaderObject *self)
|
||||
{
|
||||
Py_INCREF(self);
|
||||
return (PyObject *) self;
|
||||
}
|
||||
|
||||
|
||||
/* Log File Format
|
||||
* ---------------
|
||||
|
@ -1352,7 +1345,7 @@ static PyTypeObject LogReaderType = {
|
|||
0, /* tp_clear */
|
||||
0, /* tp_richcompare */
|
||||
0, /* tp_weaklistoffset */
|
||||
(getiterfunc)logreader_tp_iter, /* tp_iter */
|
||||
PyObject_GenericGetIter, /* tp_iter */
|
||||
(iternextfunc)logreader_tp_iternext,/* tp_iternext */
|
||||
logreader_methods, /* tp_methods */
|
||||
logreader_members, /* tp_members */
|
||||
|
|
|
@ -1961,13 +1961,6 @@ array_iter(arrayobject *ao)
|
|||
return (PyObject *)it;
|
||||
}
|
||||
|
||||
static PyObject *
|
||||
arrayiter_getiter(PyObject *it)
|
||||
{
|
||||
Py_INCREF(it);
|
||||
return it;
|
||||
}
|
||||
|
||||
static PyObject *
|
||||
arrayiter_next(arrayiterobject *it)
|
||||
{
|
||||
|
@ -2021,7 +2014,7 @@ static PyTypeObject PyArrayIter_Type = {
|
|||
0, /* tp_clear */
|
||||
0, /* tp_richcompare */
|
||||
0, /* tp_weaklistoffset */
|
||||
(getiterfunc)arrayiter_getiter, /* tp_iter */
|
||||
PyObject_GenericGetIter, /* tp_iter */
|
||||
(iternextfunc)arrayiter_next, /* tp_iternext */
|
||||
0, /* tp_methods */
|
||||
};
|
||||
|
|
|
@ -81,13 +81,6 @@ xreadlines_item(PyXReadlinesObject *a, int i)
|
|||
return xreadlines_common(a);
|
||||
}
|
||||
|
||||
static PyObject *
|
||||
xreadlines_getiter(PyXReadlinesObject *a)
|
||||
{
|
||||
Py_INCREF(a);
|
||||
return (PyObject *)a;
|
||||
}
|
||||
|
||||
static PyObject *
|
||||
xreadlines_iternext(PyXReadlinesObject *a)
|
||||
{
|
||||
|
@ -159,7 +152,7 @@ static PyTypeObject XReadlinesObject_Type = {
|
|||
0, /* tp_clear */
|
||||
0, /* tp_richcompare */
|
||||
0, /* tp_weaklistoffset */
|
||||
(getiterfunc)xreadlines_getiter, /* tp_iter */
|
||||
PyObject_GenericGetIter, /* tp_iter */
|
||||
(iternextfunc)xreadlines_iternext, /* tp_iternext */
|
||||
};
|
||||
|
||||
|
|
Loading…
Reference in New Issue