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.
This commit is contained in:
Raymond Hettinger 2003-05-07 01:28:47 +00:00
parent a409f7c491
commit 686b14d7ad
4 changed files with 9 additions and 8 deletions

View file

@ -753,8 +753,6 @@ tuple_iter(PyObject *seq)
PyErr_BadInternalCall();
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)
return NULL;