[issue14350] Strange Exception from copying an iterable
Ramchandra Apte maniandra...@gmail.com added the comment: BTW, can we add support for copying iterators by using itertools.tee -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue14350 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue14350] Strange Exception from copying an iterable
Jakob Bowyer jkb...@gmail.com added the comment: C:\Users\Jakobpython -c import copy; copy.copy(iter([1,2,3])) Traceback (most recent call last): File string, line 1, in module File T:\languages\Python27\lib\copy.py, line 96, in copy return _reconstruct(x, rv, 0) File T:\languages\Python27\lib\copy.py, line 329, in _reconstruct y = callable(*args) File T:\languages\Python27\lib\copy_reg.py, line 93, in __newobj__ return cls.__new__(cls, *args) TypeError: object.__new__(listiterator) is not safe, use listiterator.__new__() C:\Users\Jakobpython3 -c import copy; copy.copy(iter([1,2,3])) Traceback (most recent call last): File string, line 1, in module File T:\languages\Python32\lib\copy.py, line 97, in copy return _reconstruct(x, rv, 0) File T:\languages\Python32\lib\copy.py, line 285, in _reconstruct y = callable(*args) File T:\languages\Python32\lib\copyreg.py, line 88, in __newobj__ return cls.__new__(cls, *args) TypeError: object.__new__(list_iterator) is not safe, use list_iterator.__new__() Pure python traceback. Just for clarity. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue14350 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue14350] Strange Exception from copying an iterable
New submission from Jakob Bowyer jkb...@gmail.com: Running: Python 2.7.2 (default, Jun 12 2011, 14:24:46) [MSC v.1500 64 bit (AMD64)] Code: import copy copy.copy(iter([1,2,3])) Exception: --- TypeError Traceback (most recent call last) T:\languages\Python27\Scripts\ipython-input-2-4b0069a09ded in module() 1 copy.copy(iter([1,2,3])) T:\languages\Python27\lib\copy.pyc in copy(x) 94 raise Error(un(shallow)copyable object of type %s % cl s) 95 --- 96 return _reconstruct(x, rv, 0) 97 98 T:\languages\Python27\lib\copy.pyc in _reconstruct(x, info, deep, memo) 327 if deep: 328 args = deepcopy(args, memo) -- 329 y = callable(*args) 330 memo[id(x)] = y 331 T:\languages\Python27\lib\copy_reg.pyc in __newobj__(cls, *args) 91 92 def __newobj__(cls, *args): --- 93 return cls.__new__(cls, *args) 94 95 def _slotnames(cls): TypeError: object.__new__(listiterator) is not safe, use listiterator.__new__() Either this is a bug or not a clear error message in the exception -- components: None messages: 156189 nosy: Jakob.Bowyer priority: normal severity: normal status: open title: Strange Exception from copying an iterable type: behavior versions: Python 2.7 ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue14350 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue14350] Strange Exception from copying an iterable
Ramchandra Apte maniandra...@gmail.com added the comment: I get a normal exception. I see ipython at the top level in 'T:\languages\Python27\Scripts\ipython-input-2-4b0069a09ded in module()' Perhaps you ran ipython accidentally? -- nosy: +ramchandra.apte ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue14350 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue14350] Strange Exception from copying an iterable
R. David Murray rdmur...@bitdance.com added the comment: @Ramchandra: I think you referring to the traceback format (which is indeed less useful than a normal Python traceback in the context of this tracker). The OP, however, is referring to the exception itself: TypeError: object.__new__(listiterator) is not safe, use listiterator.__new__() This is indeed a bit unexpected, though I don't know that copying iterators is actually supported. -- nosy: +r.david.murray ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue14350 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue14350] Strange Exception from copying an iterable
Changes by R. David Murray rdmur...@bitdance.com: -- versions: +Python 3.2, Python 3.3 ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue14350 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com