[lxml-dev] problem with lxml and copy.deepcopy
Stefan Behnel
behnel_ml at gkec.informatik.tu-darmstadt.de
Tue Oct 17 19:12:43 CEST 2006
Hi,
Chris Abraham wrote:
> I'm having a problem with performing a copy.deepcopy on a list of
> elements. I'm finding the etree._Comment elements get turned into
> None.
Verified, thanks for reporting this. It's easy to reproduce like this:
a = Comment("ONE")
b = copy.deepcopy(a)
The reason is that we create a new document internally and make the new
element the root node. If it's a comment (or PI), however, libxml2 can't look
it up right away with the normal call for the document root node, so we have
to special case this (rare) use case.
Fixed for 1.1 and trunk.
Stefan
More information about the lxml-dev
mailing list