[New-bugs-announce] [issue18352] collections.Counter with added attributes are not deepcopied properly.

Olivier Gagnon report at bugs.python.org
Wed Jul 3 16:43:25 CEST 2013


New submission from Olivier Gagnon:

The following code shows that the Counter is not deepcopied properly. The 
same code with an user defined class or a dict is copied with the "b" attribute.

import collections
import copy

count = collections.Counter()
count.b = 3
print(count.b) # prints 3

count_copy = copy.deepcopy(count)
print(count_copy.b) # raise AttributeError: 'Counter' object has no attribute 'b'

----------
components: Library (Lib)
messages: 192239
nosy: Olivier.Gagnon
priority: normal
severity: normal
status: open
title: collections.Counter with added attributes are not deepcopied properly.
type: behavior
versions: Python 3.3

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue18352>
_______________________________________


More information about the New-bugs-announce mailing list