[lxml-dev] seg. fault using _Comment

Stefan Behnel stefan_ml at behnel.de
Wed Nov 12 09:27:40 CET 2008


Frédéric Mantegazza wrote:
> I'm trying to use comments in my xml file. The goal is to be able to
> enable/disable some entries in a config. file.
>
> Parsing comments works fine; when getting a node, I check if it is a
> _Comment object. If so, I just parse the string contained in the comment.

I'd rather check for "el.tag is etree.Comment". "_Comment" starts with an
underscore, which makes it a non-public class.


> Now, I would like to do the reverse operation: save some entries as
> comments. But it fails. I instanciate a _Comment object, but as soon as I
> use it, the application crashed with seg. fault.

Use the Comment factory.

Stefan



More information about the lxml-dev mailing list