[lxml-dev] Python interpreter segfault setting element tail

Thanks for lxml - very nice.
Unfortunately the following fragment causes my python interpreter to crash and burn:
---------------- from lxml import etree
root = etree.fromstring('<html><p></p>x</html>') for elem in root: elem.tail = '' -----------------
System:
gentoo linux 2004.3 on x86 python 2.4.1 lxml 0.7 (and 0.6) libxml 2.6.19
Kieran

Kieran Holland wrote:
Thanks for lxml - very nice.
Unfortunately the following fragment causes my python interpreter to crash and burn:
from lxml import etree
root = etree.fromstring('<html><p></p>x</html>') for elem in root: elem.tail = ''
Thanks for reporting this! I have identified a bug in the iteration implementation that I need to think about a bit more. Basically the iterator now retains the next node iteration too long, and changing the text tree structure can break this assumption, causing the system to iterate off into now non-existent space.
Regards,
Martijn

Martijn Faassen wrote:
Kieran Holland wrote:
Thanks for lxml - very nice.
Unfortunately the following fragment causes my python interpreter to crash and burn:
from lxml import etree
root = etree.fromstring('<html><p></p>x</html>') for elem in root: elem.tail = ''
Thanks for reporting this! I have identified a bug in the iteration implementation that I need to think about a bit more. Basically the iterator now retains the next node iteration too long, and changing the text tree structure can break this assumption, causing the system to iterate off into now non-existent space.
I've finally checked in a fix for this! Thanks for waiting!
Regards,
Martijn
participants (2)
-
Kieran Holland
-
Martijn Faassen