[lxml-dev] [BUG] lxml-2* hangs on interpreter shutdown with gtk-mainloop

Stefan Behnel stefan_ml at behnel.de
Sun Mar 16 13:59:54 CET 2008


Hi,

René 'Necoro' Neumann wrote:
> I'm developing a PyGTK-application that uses lxml to validate plugin-XMLs.
> After upgrading to lxml-2*, I noticed, that my application is not shut
> down correctly (i.e. I close the application, but it still runs in the
> background).

I looked into this again and came up with a simple change to your example that
works. Instead of

	parse(StringIO(...))

use

	parse(StringIO(...), base_url="http://the/url")

I have no idea why that works, there isn't any apparent reason why that makes
a difference - the different code path is not related to any threading at all.
So I suppose this only works around a symptom (threading issues can really be
that bizarre).

Also, as you noted, calling fromstring() instead of parse() works for whatever
reason, although parse(StringIO(...)) does essentially the same thing internally.

I attached a patch that also works for me and (again) seems to work around the
symptom you see.

Stefan
-------------- next part --------------
A non-text attachment was scrubbed...
Name: parse-gtk-problem.patch
Type: text/x-patch
Size: 1698 bytes
Desc: not available
Url : http://codespeak.net/pipermail/lxml-dev/attachments/20080316/e587e25c/attachment.bin 


More information about the lxml-dev mailing list