[Pyrex] Pythonic wrapping of libxml2

vng1 at mac.com vng1 at mac.com
Wed Sep 29 16:24:57 CEST 2004


I'm trying to re-do the libxml2 bindings for a couple reasons:

1 - I'd really like to raise my own comfort level when doing C 
extensions in Python and wrapping C libraries.  From the small 
extensions I _have_ written, Pyrex is a lot nicer to deal with than 
SWIG.  I've never used CTypes before, but some of the messages in this 
list seem to indicate that there are bugs in CTypes itself:

http://lists.copyleft.no/pipermail/pyrex/2004-June/000804.html

2 - I badly need libxml2 in an application I am writing.  The modules I 
absolutely need are tree and xpath.  If I can get  relaxng and 
xmlreader, that would be really nice, but mostly I just need tree and 
xpath.

The 'standard' libxml2 bindings are not just un-pythonic, they're just 
plain broken.  If you are building up a document and you use XPath at 
the same time, you have no way of managing the memory allocation 
without leaking memory.

XPath queries always return new xmlNode wrappers.  xmlNode's do not 
properly implement object identity so you can't 'know' when to free 
something from memory.

http://mail.gnome.org/archives/xml/2004-June/msg00153.html

Obviously - that kind of a bug makes using libxml2 useless for a long 
running process - so I'm trying to rectify that using Pyrex.

vic

---
Don't be humble ... you're not that great.    -- Golda Meir

On 29-Sep-04, at 05:55 AM, Martijn Faassen wrote:

> vng1 at mac.com wrote:
>> So - back to the topic at hand - how do you do function pointers in 
>> Pyrex?
>
> And I still want to know what're you wrapping libxml2 for. :)
>
> Regards,
>
> Martijn
>
>
>
> _______________________________________________
> Pyrex mailing list
> Pyrex at lists.copyleft.no
> http://lists.copyleft.no/mailman/listinfo/pyrex
>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/pkcs7-signature
Size: 3901 bytes
Desc: not available
Url : http://lists.copyleft.no/pipermail/pyrex/attachments/20040929/dbd9ac12/smime.bin


More information about the Pyrex mailing list