mirror of
https://github.com/python/cpython.git
synced 2025-10-09 08:31:26 +00:00
Created PyObject_GenericGetIter().
Factors out the common case of returning self.
This commit is contained in:
parent
0153826964
commit
e0cce8f8f0
3 changed files with 3 additions and 24 deletions
|
@ -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 */
|
||||
};
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue