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 Olivier.Gagnon
Recipients Olivier.Gagnon, eric.snow, madison.may, rhettinger, serhiy.storchaka, vajrasky
Date 2013-07-10.14:28:35
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1373466515.3.0.121712462561.issue18352@psf.upfronthosting.co.za>
In-reply-to
Content
The dictionary and the set do not give the freedom to add dynamic attributes to them. I agree that the Counter should have the same behaviour.

However, this will raise the same bug when we inherit from a Counter object.

>>> class mylist(list): pass
... 
>>> l = mylist()
>>> l.foo = "bar"
>>> c = copy.deepcopy(l)
>>> print(c.foo) # prints bar

>>> class myCounter(Counter): pass
... 
>>> original = myCounter()
>>> original.foo = "bar"
>>> c = copy.deepcopy(original)
>>> c.foo
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
AttributeError: 'myCounter' object has no attribute 'foo'

The reduction function should still copy every dynamic attribute of the object.
History
Date User Action Args
2013-07-10 14:28:35Olivier.Gagnonsetrecipients: + Olivier.Gagnon, rhettinger, eric.snow, serhiy.storchaka, madison.may, vajrasky
2013-07-10 14:28:35Olivier.Gagnonsetmessageid: <1373466515.3.0.121712462561.issue18352@psf.upfronthosting.co.za>
2013-07-10 14:28:35Olivier.Gagnonlinkissue18352 messages
2013-07-10 14:28:35Olivier.Gagnoncreate