mirror of
https://github.com/python/cpython.git
synced 2025-08-04 00:48:58 +00:00
Created PyObject_GenericGetIter().
Factors out the common case of returning self.
This commit is contained in:
parent
08801db123
commit
0153826964
10 changed files with 30 additions and 147 deletions
|
@ -2013,13 +2013,6 @@ dictiter_dealloc(dictiterobject *di)
|
|||
PyObject_Del(di);
|
||||
}
|
||||
|
||||
static PyObject *
|
||||
dictiter_getiter(PyObject *it)
|
||||
{
|
||||
Py_INCREF(it);
|
||||
return it;
|
||||
}
|
||||
|
||||
static PyObject *dictiter_iternext(dictiterobject *di)
|
||||
{
|
||||
PyObject *key, *value;
|
||||
|
@ -2069,7 +2062,7 @@ PyTypeObject PyDictIter_Type = {
|
|||
0, /* tp_clear */
|
||||
0, /* tp_richcompare */
|
||||
0, /* tp_weaklistoffset */
|
||||
(getiterfunc)dictiter_getiter, /* tp_iter */
|
||||
PyObject_GenericGetIter, /* tp_iter */
|
||||
(iternextfunc)dictiter_iternext, /* tp_iternext */
|
||||
0, /* tp_methods */
|
||||
0, /* tp_members */
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue