Issue1991

classification
Title: broken iterator propagation
Type: behaviour Severity: critical
Components: Core Versions: Jython 2.7
process
Status: open Resolution:
Dependencies: Superseder:
Assigned To: fwierzbicki Nosy List: fwierzbicki, zzzeek
Priority: high Keywords:

Created on 2012-11-19.17:47:25 by zzzeek, last changed 2013-02-20.00:20:09 by fwierzbicki.

Messages
msg7530 (view) Author: mike bayer (zzzeek) Date: 2012-11-19.17:47:25
This might be limited to the itertools library, as I was not able to reproduce this using freeform iterator objects...nonetheless this is pretty core.

Propagation of iterator objects, at least in the case of itertools.chain(), appears to be broken:

from itertools import chain

class MyClass(object):
    def __iter__(self):
        return chain([1, 2, 3])


my_obj = MyClass()

print list(my_obj)  # python prints [1,2,3], jython prints []

chain_obj = my_obj.__iter__()

assert list(chain_obj) == list(my_obj)


Above, the "chain()" object returned by my_obj.__iter__() works fine and yields [1,2,3], however when my_obj itself is called in an iterator context, the iterator yields nothing.  The assertion at the end fails on Jython and passes on cPython.
msg7531 (view) Author: Frank Wierzbicki (fwierzbicki) Date: 2012-11-19.17:53:02
zzzeek: thanks for the ongoing beat down on 2.7 - I'll keep an eye on these!
History
Date User Action Args
2013-02-20 00:20:09fwierzbickisetpriority: high
assignee: fwierzbicki
versions: + Jython 2.7, - 2.7a2
2012-11-19 17:53:03fwierzbickisetnosy: + fwierzbicki
messages: + msg7531
2012-11-19 17:47:25zzzeekcreate