[lxml-dev] Dealing with segfaults in lxml?

Stefan Behnel stefan_ml at behnel.de
Thu Oct 11 17:18:57 CEST 2007


Mike Meyer wrote:
> On Wed, 10 Oct 2007 09:03:04 +0200 Stefan Behnel <stefan_ml at behnel.de> wrote:
>>     d = dict(node.items())
>>
>> or something in that line, which should even be faster as it avoids the
>> intermediate attrib proxy and iterator creation steps. If you wan to be more
>> selective, a generator expression will do.
> 
> I tried the node.items() variation, and that was still causing
> segfaults.

Then it's still different than I thought. If all you change is this line:

   d = dict(node.attrib)

and you get segfaults with this:

   d = dict(node.items())

but not with this:

   d = dict()
   for key in keys:
       d[key] = node.get(key, '´)

I really can't extract anything meaningful from that. The complete valgrind
trace would be helpful.

Stefan


More information about the lxml-dev mailing list