Given the PyObject
created by PyBindGen
, it's easy to get the pointer to the wrapped C++ object, just use the obj
member in the struct:
typedef struct {
PyObject_HEAD
MyWrappedClass *obj;
PyObject *inst_dict;
PyBindGenWrapperFlags flags:8;
} PyMyWrappedClass;
However, let's say I have just MyWrappedClass*
, and want to get the PyObject
(if any, it might not exist) that wraps it. Is there any way to do this without maintaining my own dictionary of backpointers?