[Python-checkins] python/dist/src/Python ceval.c,2.316,2.317

tim_one@users.sourceforge.net tim_one@users.sourceforge.net
Tue, 16 Jul 2002 17:15:25 -0700


Update of /cvsroot/python/python/dist/src/Python
In directory usw-pr-cvs1:/tmp/cvs-serv11884/python/Python

Modified Files:
	ceval.c 
Log Message:
There's no need for generators to define an explicit next() method.


Index: ceval.c
===================================================================
RCS file: /cvsroot/python/python/dist/src/Python/ceval.c,v
retrieving revision 2.316
retrieving revision 2.317
diff -C2 -d -r2.316 -r2.317
*** ceval.c	14 Jul 2002 00:27:26 -0000	2.316
--- ceval.c	17 Jul 2002 00:15:22 -0000	2.317
***************
*** 167,185 ****
  
  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)
  {
--- 167,170 ----
***************
*** 188,197 ****
  }
  
- 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},
--- 173,176 ----
***************
*** 230,234 ****
  	(getiterfunc)gen_getiter,		/* tp_iter */
  	(iternextfunc)gen_iternext,		/* tp_iternext */
! 	gen_methods,				/* tp_methods */
  	gen_memberlist,				/* tp_members */
  	0,					/* tp_getset */
--- 209,213 ----
  	(getiterfunc)gen_getiter,		/* tp_iter */
  	(iternextfunc)gen_iternext,		/* tp_iternext */
! 	0,					/* tp_methods */
  	gen_memberlist,				/* tp_members */
  	0,					/* tp_getset */