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.

classification
Title: deepcopy of itertools.count resets the count
Type: Stage:
Components: Library (Lib) Versions: Python 3.2, Python 2.7
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: rhettinger Nosy List: rbcollins, rhettinger
Priority: low Keywords:

Created on 2009-11-30 02:04 by rbcollins, last changed 2022-04-11 14:56 by admin. This issue is now closed.

Messages (2)
msg95830 - (view) Author: Robert Collins (rbcollins) * (Python committer) Date: 2009-11-30 02:04
>>> from copy import deepcopy
>>> from itertools import count
>>> c = count()
>>> c.next()
0
>>> deepcopy(c)
count(0)
>>> c.next()
1
>>> deepcopy(c)
count(0)
>>> c
count(2)
>>> deepcopy(c).next()
0


I don't see any reason why these shouldn't be deepcopyable (or picklable
for that reason - and that fails too)
msg95834 - (view) Author: Raymond Hettinger (rhettinger) * (Python committer) Date: 2009-11-30 11:15
Fixed in r76599.
History
Date User Action Args
2022-04-11 14:56:55adminsetgithub: 51659
2009-11-30 22:02:58rhettingersetstatus: open -> closed
resolution: fixed
2009-11-30 11:15:50rhettingersetmessages: + msg95834
2009-11-30 06:09:00rhettingersetpriority: low
2009-11-30 05:47:05rhettingersetassignee: rhettinger

nosy: + rhettinger
2009-11-30 02:04:46rbcollinscreate