[lxml-dev] Is it bug?

Stefan Behnel stefan_ml at behnel.de
Tue Jun 12 15:46:55 CEST 2007


Hi,

Stefan Behnel wrote:
> Alexander Kozlovsky wrote:
>> I discover some counterintuitive behavior of 'tail' attribute:
>>
>>     >>> from lxml import etree
>>     >>> a = etree.XML('<a><b>text</b>tail</a>')
>>     >>> b = a[0]
>>     >>> print b.tail
>>     tail
>>     >>> a[:] = []
>>     >>> print b.tail
>>     None  #  EXPECTED: tail
>>
>> I think, it is bug or at least worth note in documentation
> 
> Definitely looks like a bug to me. The tail should stay with the unlinked
> element. Thanks for the report, I'll look into this.

Here's a patch, applied against the current trunk (applying it against 1.3beta
should also work).

Stefan
-------------- next part --------------
A non-text attachment was scrubbed...
Name: slice-tail-bug.patch
Type: text/x-diff
Size: 2808 bytes
Desc: not available
Url : http://codespeak.net/pipermail/lxml-dev/attachments/20070612/691b05cf/attachment.bin 


More information about the lxml-dev mailing list