[Python-checkins] python/dist/src/Modules _hotshot.c,1.32,1.33 arraymodule.c,2.84,2.85 xreadlinesmodule.c,1.13,1.14

rhettinger@users.sourceforge.net rhettinger@users.sourceforge.net
Mon, 17 Mar 2003 00:35:54 -0800


Update of /cvsroot/python/python/dist/src/Modules
In directory sc8-pr-cvs1:/tmp/cvs-serv4768

Modified Files:
	_hotshot.c arraymodule.c xreadlinesmodule.c 
Log Message:
Created PyObject_GenericGetIter().
Factors out the common case of returning self.



Index: _hotshot.c
===================================================================
RCS file: /cvsroot/python/python/dist/src/Modules/_hotshot.c,v
retrieving revision 1.32
retrieving revision 1.33
diff -C2 -d -r1.32 -r1.33
*** _hotshot.c	6 Jan 2003 12:41:25 -0000	1.32
--- _hotshot.c	17 Mar 2003 08:35:49 -0000	1.33
***************
*** 142,152 ****
  }
  
- static PyObject *
- logreader_tp_iter(LogReaderObject *self)
- {
-     Py_INCREF(self);
-     return (PyObject *) self;
- }
- 
  
  /* Log File Format
--- 142,145 ----
***************
*** 1353,1357 ****
      0,					/* tp_richcompare	*/
      0,					/* tp_weaklistoffset	*/
!     (getiterfunc)logreader_tp_iter,	/* tp_iter		*/
      (iternextfunc)logreader_tp_iternext,/* tp_iternext		*/
      logreader_methods,			/* tp_methods		*/
--- 1346,1350 ----
      0,					/* tp_richcompare	*/
      0,					/* tp_weaklistoffset	*/
!     PyObject_GenericGetIter,		/* tp_iter		*/
      (iternextfunc)logreader_tp_iternext,/* tp_iternext		*/
      logreader_methods,			/* tp_methods		*/

Index: arraymodule.c
===================================================================
RCS file: /cvsroot/python/python/dist/src/Modules/arraymodule.c,v
retrieving revision 2.84
retrieving revision 2.85
diff -C2 -d -r2.84 -r2.85
*** arraymodule.c	24 Feb 2003 02:08:42 -0000	2.84
--- arraymodule.c	17 Mar 2003 08:35:49 -0000	2.85
***************
*** 1963,1973 ****
  
  static PyObject *
- arrayiter_getiter(PyObject *it)
- {
- 	Py_INCREF(it);
- 	return it;
- }
- 
- static PyObject *
  arrayiter_next(arrayiterobject *it)
  {
--- 1963,1966 ----
***************
*** 2022,2026 ****
  	0,                                      /* tp_richcompare */
  	0,                                      /* tp_weaklistoffset */
! 	(getiterfunc)arrayiter_getiter,		/* tp_iter */
  	(iternextfunc)arrayiter_next,		/* tp_iternext */
  	0,					/* tp_methods */
--- 2015,2019 ----
  	0,                                      /* tp_richcompare */
  	0,                                      /* tp_weaklistoffset */
! 	PyObject_GenericGetIter,		/* tp_iter */
  	(iternextfunc)arrayiter_next,		/* tp_iternext */
  	0,					/* tp_methods */

Index: xreadlinesmodule.c
===================================================================
RCS file: /cvsroot/python/python/dist/src/Modules/xreadlinesmodule.c,v
retrieving revision 1.13
retrieving revision 1.14
diff -C2 -d -r1.13 -r1.14
*** xreadlinesmodule.c	6 Aug 2002 17:14:04 -0000	1.13
--- xreadlinesmodule.c	17 Mar 2003 08:35:49 -0000	1.14
***************
*** 83,93 ****
  
  static PyObject *
- xreadlines_getiter(PyXReadlinesObject *a)
- {
- 	Py_INCREF(a);
- 	return (PyObject *)a;
- }
- 
- static PyObject *
  xreadlines_iternext(PyXReadlinesObject *a)
  {
--- 83,86 ----
***************
*** 160,164 ****
  	0,					/* tp_richcompare */
  	0,					/* tp_weaklistoffset */
! 	(getiterfunc)xreadlines_getiter,	/* tp_iter */
  	(iternextfunc)xreadlines_iternext,	/* tp_iternext */
  };
--- 153,157 ----
  	0,					/* tp_richcompare */
  	0,					/* tp_weaklistoffset */
! 	PyObject_GenericGetIter,		/* tp_iter */
  	(iternextfunc)xreadlines_iternext,	/* tp_iternext */
  };