mirror of
https://github.com/python/cpython.git
synced 2025-10-10 00:43:41 +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
|
@ -78,13 +78,6 @@ enum_next(enumobject *en)
|
|||
return result;
|
||||
}
|
||||
|
||||
static PyObject *
|
||||
enum_getiter(PyObject *en)
|
||||
{
|
||||
Py_INCREF(en);
|
||||
return en;
|
||||
}
|
||||
|
||||
PyDoc_STRVAR(enum_doc,
|
||||
"enumerate(iterable) -> create an enumerating-iterator");
|
||||
|
||||
|
@ -117,7 +110,7 @@ PyTypeObject PyEnum_Type = {
|
|||
0, /* tp_clear */
|
||||
0, /* tp_richcompare */
|
||||
0, /* tp_weaklistoffset */
|
||||
(getiterfunc)enum_getiter, /* tp_iter */
|
||||
PyObject_GenericGetIter, /* tp_iter */
|
||||
(iternextfunc)enum_next, /* tp_iternext */
|
||||
0, /* tp_methods */
|
||||
0, /* tp_members */
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue