[PyQt] SIP and void* handling

Scott Talbert swt at techie.net
Mon Jul 4 03:59:57 BST 2016


Hi,

I have a wrapped C++ class with a function that returns a void*.

Also, I have a Python class that inherits from the wrapped C++ class and 
overrides the function that returns a void*.

Lastly, I have C++ code that ends up calling the Python subclass's void* 
function.  When this happens, however, I'm getting this error:

TypeError: invalid result from MyDataTable.GetValueAsCustom(), an integer 
is required

This appears to be because the Python class (MyDataTable) is getting 
returned as the void*, not a sip.voidptr.  How do I get a sip.voidptr to 
be returned?

One additional caveat, the C++ code expects to delete the void* object, so 
it needs to take ownership of it as well.

Thanks,
Scott


More information about the PyQt mailing list