[lxml-dev] Does etree.iter() handle the refcount properly?

Andrew Wang azuriel at gmail.com
Wed Jul 9 02:28:52 CEST 2008


On Mon, Jul 7, 2008 at 4:05 AM, Stefan Behnel <stefan_ml at behnel.de> wrote:
> Hi,
>
> Andrew Wang wrote:
>> I just started using lxml and I ran into an odd problem. I'm using
>> version 2.0.4-14 from the OpenSuSE repositories.
>>
>> import lxml.etree as etree
>>
>> # test.py
>> xml = '''\
>> <?xml version="1.0"?>
>> <xml/>'''
>>
>> for i in range(10000):
>>     et = etree.fromstring(xml)
>>     for el in et.iter():
>>         pass
>>
>> $ python test.py
>> Fatal Python error: deallocating None
>> Aborted
>>
>> Is this a bug, or am I using etree.iter() incorrectly?
>
> Works for me in the latest version.
>
> Stefan
>

Thanks for the feedback. I've tried version 2.0.7 now and I get the same error.

I'm starting to suspect it's something wrong with my OpenSUSE 11.0
install, because this same code worked on lxml version 2.0.5 on a
Gentoo box...I'll take my problem to the OpenSUSE bugzilla unless
someone else can reproduce it.

Andrew


More information about the lxml-dev mailing list