I have a python method in one library that returns a image handle as a PyCapsule. I need to pass the handle to another library that expects it as a c_void_p. How can I convert the capsule into a c_void_p to facilitate this interop?
I tried the following casts in Python, but to no avail
addr = ctypes.py_object(capsule)
PyCapsule_GetPointer
throughctypes.pythonapi
would probably do it, but remember to setargtypes
andrestype
first.