Issue1768970

classification
Title: pyget used instead of __getitem__ in __iter__, filter
Type: Severity: normal
Components: Core Versions:
Milestone:
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: Nosy List: cgroves, mehendran, zyasoft
Priority: normal Keywords: test failure causes

Created on 2007-08-07.05:11:38 by cgroves, last changed 2008-09-14.01:17:48 by zyasoft.

Messages
msg1815 (view) Author: Charlie Groves (cgroves) Date: 2007-08-07.05:11:38
The special PySequence method pyget is used instead of __getitem__ in iterators return by __iter__ from PySequences.  PySequence is used in the implementation of str, list and various other sequence like objects.  If one of these types is subclassed in python code and the subclass overrides the __getitem__ method, the iterator returned by __iter__ doesn't go through the new __getitem__ method.

This was causing a test_builtin to fail when testing filter as it was expecting filtering on a subclass of list to go through __getitem__ by virtue of going through its __iter__ method.  That failing test case has been disabled for now as explained in http://wiki.python.org/jython/JythonDeveloperGuide/VersionTransitionTestExclusions
msg1816 (view) Author: Mehendran (mehendran) Date: 2007-08-24.09:41:34
I am looking at this bug. I will come with the patch soon
msg1817 (view) Author: Mehendran (mehendran) Date: 2007-08-31.10:11:31
Patch is been added.

[ 1785475 ] patch for bug IDs 1768970, 1782565 & 1783868
msg3569 (view) Author: Jim Baker (zyasoft) Date: 2008-09-14.01:17:48
*Apparently* fixed in 2.5, since it's passing the test, and I don't see
any use of pyget by PySequenceIter. But I didn't see a revision for
this, the use of __finditem__ goes back to Finn Bock.

Tested by test_builtin.BuiltinTest.test_filter, where __getitem__ is
repeatedly overridden in crazy ways. So it looks solid.
History
Date User Action Args
2008-09-14 01:17:48zyasoftsetstatus: open -> closed
nosy: + zyasoft
resolution: fixed
messages: + msg3569
2007-08-07 05:11:38cgrovescreate