[issue10131] deepcopying an xml.dom.minidom.Document generates an invalid XML document

Yevgen Yampolskiy report at bugs.python.org
Sat Oct 22 19:29:14 CEST 2011


Yevgen Yampolskiy <genij.math at gmail.com> added the comment:

You can create object copy using both copy and pickle modules. 
I assume that identical results should be produced.

pickle handles minidom.Document correctly, however copy does not. 
Even if patch to NodeList will be applied, copy or pickle modules need to be adjusted to produce identical results.

>From this view point copy module needs to be adjusted.

Here is the test code:

import copy, pickle
from xml.dom.minidom import NodeList

obj = NodeList()
obj.append('a')

obj2 = copy.deepcopy(obj)
print(obj2)

obj2 = pickle.loads(pickle.dumps(obj))
print(obj2)

Output (python 2.7-3.2):
['a', 'a']
['a']

----------
nosy: +genij.math

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


More information about the Python-bugs-list mailing list