On Wed, Nov 09, 2005 at 11:59:52AM +0100, Stefan Behnel wrote:
Stefan Behnel wrote:
Mechiel Lukkien wrote:
my quick fix was to return an empty string at the start of funicode if the string is null. after this, it stopped segfaulting on this small example. good chance that breaks tostring() though.
I don't think it does, I'd rather say that would be the right thing to do. I do believe, however, that it should be a bug somewhere else in etree if funicode() is *called* with NULL, so I won't fix it there. It should be caught in XSLT.tostring, which is where the error arises, since afterwards, we call xmlFree on the string (or on NULL resp.).
I've applied test case and fix to the trunk, revision 19670/19671.
Mechiel, since you've used SVN anyway, please update your version and retry.
i just updated to the latest version and tried. it seems to work fine. one more remark: with a non-empty document, tostring() generates xml (or so it seems). with an empty document it generates an empty string. is that a valid xml document as well? at least there is no '<?xml version="1.0"?>' in the output. i tried lxml.etree.parse() on an empty file and on a file with just the xml version tag-like line. it raised etree.XMLSyntaxError for both. i'm not sure what tostring() exactly means to do though. if it's "generate valid xml" it might be better to raise some exception in this case. thanks for the quick response, best regards, mechiel