[Python-checkins] python/dist/src/Objects listobject.c,2.151,2.152 tupleobject.c,2.80,2.81

rhettinger@users.sourceforge.net rhettinger@users.sourceforge.net
Tue, 06 May 2003 18:28:49 -0700


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

Modified Files:
	listobject.c tupleobject.c 
Log Message:
SF bug #730296: Unexpected Changes in list Iterator

Reverted a Py2.3b1 change to iterator in subclasses of list and tuple.
They had been changed to use __getitem__ whenever it had been overriden
in the subclass.

This caused some usabilty and performance problems.  Also, it was
inconsistent with the rest of python where many container methods
access the underlying object directly without first checking for
an overridden getter.  Users needing a change in iterator behavior
should override it directly.



Index: listobject.c
===================================================================
RCS file: /cvsroot/python/python/dist/src/Objects/listobject.c,v
retrieving revision 2.151
retrieving revision 2.152
diff -C2 -d -r2.151 -r2.152
*** listobject.c	3 May 2003 10:53:08 -0000	2.151
--- listobject.c	7 May 2003 01:28:47 -0000	2.152
***************
*** 2383,2388 ****
  		return NULL;
  	}
- 	if (seq->ob_type->tp_as_sequence->sq_item != (intargfunc)list_item)
- 		return PySeqIter_New(seq);
  	it = PyObject_GC_New(listiterobject, &PyListIter_Type);
  	if (it == NULL)
--- 2383,2386 ----

Index: tupleobject.c
===================================================================
RCS file: /cvsroot/python/python/dist/src/Objects/tupleobject.c,v
retrieving revision 2.80
retrieving revision 2.81
diff -C2 -d -r2.80 -r2.81
*** tupleobject.c	24 Apr 2003 20:59:52 -0000	2.80
--- tupleobject.c	7 May 2003 01:28:47 -0000	2.81
***************
*** 754,759 ****
  		return NULL;
  	}
- 	if (seq->ob_type->tp_as_sequence->sq_item != (intargfunc)tupleitem)
- 		return PySeqIter_New(seq);
  	it = PyObject_GC_New(tupleiterobject, &PyTupleIter_Type);
  	if (it == NULL)
--- 754,757 ----