Raymond Hettinger added the comment: 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>,)) ---------- nosy: +kristjan.jonsson, serhiy.storchaka _______________________________________ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue29897> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com