[lxml-dev] problem with lxml and copy.deepcopy
Chris Abraham
cabraham at openplans.org
Tue Oct 17 20:46:39 CEST 2006
Stefan,
Thanks. This works well (and seems to have solved other problems I was
having.)
Chris
Stefan Behnel wrote:
> 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
>
> !DSPAM:1018,45350f1366461116498154!
>
>
More information about the lxml-dev
mailing list