[PyKDE] [PATCH] Add sip api method api_find_module

Phil Thompson phil at riverbankcomputing.co.uk
Fri Dec 15 18:35:40 GMT 2006


On Wednesday 13 December 2006 7:59 pm, Matt Newell wrote:
> Lately I've been writing some code to call python functions and pass
> objects that are wrapped using sip.  This is relatively easy when linking
> directly to a sip module and using it's generated api methods, however it
> is currently impossible(afaik) by only linking to sip, because there is no
> way to retrieve a pointer to a sipExportedModuleDef for a given module.
>
> I propose this patch that adds the function api_find_module to the
> sipAPIDef struct.   With this patch you can get the sipAPIDef * from the
> sip modules python dictionary, then use api_find_module to get the
> registered sip module. From here I can get to the sipWrapperType's for the
> module, and use them with api_convert_from_new_instance, etc.
>
> I also attached a small file showing how i use the new function.

Can you explain why you need access to these outside of a SIP generated 
module?

The sipAPIDef stuff is internal and I'd prefer it to stay that way - there is 
no guarantee that your code will continue to work with the next SIP release. 
So I'd like to see if there is a better way to meet your needs.

Phil




More information about the PyQt mailing list