This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author rhettinger
Recipients MSeifert, kristjan.jonsson, rhettinger, serhiy.storchaka
Date 2017-03-24.21:19:36
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1490390377.08.0.380485200808.issue29897@psf.upfronthosting.co.za>
In-reply-to
Content
Humph, that is definitely not the expected result.  The itertools copy/reduce support has been a never-ending source of bugs and headaches.

It looks like the problem is that __reduce__ is returning the existing tuple iterator rather than a new one:

>>> a = chain([1,2,3], [4,5,6])
>>> b = copy(a)
>>> next(a)
1
>>> a.__reduce__()
(<class 'itertools.chain'>, (), (<tuple_iterator object at 0x104ee78d0>, <list_iterator object at 0x104f81b70>))
>>> b.__reduce__()
(<class 'itertools.chain'>, (), (<tuple_iterator object at 0x104ee78d0>,))
History
Date User Action Args
2017-03-24 21:19:37rhettingersetrecipients: + rhettinger, kristjan.jonsson, serhiy.storchaka, MSeifert
2017-03-24 21:19:37rhettingersetmessageid: <1490390377.08.0.380485200808.issue29897@psf.upfronthosting.co.za>
2017-03-24 21:19:37rhettingerlinkissue29897 messages
2017-03-24 21:19:36rhettingercreate