PyCapsule in Shiboken bindings
Unsolved
Qt for Python
-
I am currently writing a python binding for a Qt C++ library using Shiboken. While most typesystem bindings are quite clear, I struggle with the usage of PyCapsule.
I would like to use a third party library that comes with a python binding and wraps a function pointer using a PyCapsule which I would like to pass to one of my library's functions in python. In my bindings I thus need to get the pointer back from this PyCapsule and pass it to my C++ Function. When writing the binding layer by hand the extraction is quite straightforward:
if (PyCapsule_CheckExact(capsule)) { ptr = PyCapsule_GetPointer(capsule, "name"); }
I attempted to write similar code in a user defined type conversion in the Shiboken type system but did not succeed so I am wondering how to appropriately treat PyCapsules in Shiboken bindings?