diff options
author | Tim Peters <tim.peters@gmail.com> | 2002-07-17 00:15:22 (GMT) |
---|---|---|
committer | Tim Peters <tim.peters@gmail.com> | 2002-07-17 00:15:22 (GMT) |
commit | a64295b43a3461c9451e10dd3094c06cfc32a5d4 (patch) | |
tree | 392324af0f7e5239840a13010a8d8499f88ac8a7 /Python/ceval.c | |
parent | 674eae65eae58a125d71d403ef243d774f5b5708 (diff) | |
download | cpython-a64295b43a3461c9451e10dd3094c06cfc32a5d4.zip cpython-a64295b43a3461c9451e10dd3094c06cfc32a5d4.tar.gz cpython-a64295b43a3461c9451e10dd3094c06cfc32a5d4.tar.bz2 |
There's no need for generators to define an explicit next() method.
Diffstat (limited to 'Python/ceval.c')
-rw-r--r-- | Python/ceval.c | 23 |
1 files changed, 1 insertions, 22 deletions
diff --git a/Python/ceval.c b/Python/ceval.c index 5122c76..8c19787 100644 --- a/Python/ceval.c +++ b/Python/ceval.c @@ -166,33 +166,12 @@ gen_iternext(genobject *gen) } static PyObject * -gen_next(genobject *gen) -{ - PyObject *result; - - result = gen_iternext(gen); - - if (result == NULL && !PyErr_Occurred()) { - PyErr_SetObject(PyExc_StopIteration, Py_None); - return NULL; - } - - return result; -} - -static PyObject * gen_getiter(PyObject *gen) { Py_INCREF(gen); return gen; } -static struct PyMethodDef gen_methods[] = { - {"next", (PyCFunction)gen_next, METH_NOARGS, - "next() -- get the next value, or raise StopIteration"}, - {NULL, NULL} /* Sentinel */ -}; - static PyMemberDef gen_memberlist[] = { {"gi_frame", T_OBJECT, offsetof(genobject, gi_frame), RO}, {"gi_running", T_INT, offsetof(genobject, gi_running), RO}, @@ -229,7 +208,7 @@ statichere PyTypeObject gentype = { 0, /* tp_weaklistoffset */ (getiterfunc)gen_getiter, /* tp_iter */ (iternextfunc)gen_iternext, /* tp_iternext */ - gen_methods, /* tp_methods */ + 0, /* tp_methods */ gen_memberlist, /* tp_members */ 0, /* tp_getset */ 0, /* tp_base */ |