New submission from Neil Harkins <nhark...@gmail.com>:

hi. after using deepcopy() on a nested dict/list structure, 
i noticed that modifications to the deepcopied structure were 
affecting the original. this looks to me like a serious bug:

>>> import copy
>>> foo = { 'a':[1,2,3], 'b':{'c':[4,5]} }
>>> bar = copy.deepcopy(foo)
>>> id(foo)
4297360512
>>> id(bar)
4297373104
>>> id(foo['a'])
4299410752
>>> id(bar['a'])
4299760200
>>> id(foo['b'])
4297371984
>>> id(bar['b'])
4297373920
>>> id(foo['b']['c'])
4299721040
>>> id(bar['b']['c'])
4299761496
>>> id(foo['b']['c'][0])
4297074656
>>> id(bar['b']['c'][0])
4297074656

----------
components: Extension Modules
messages: 114007
nosy: nharkins
priority: normal
severity: normal
status: open
title: copy.deepcopy() copying pointers from a dict/dict/list, should copy 
values
type: behavior
versions: Python 2.6

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue9616>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to