I am using PyCXX to write an extension that exposes multiple (new style) classes to Python.
A method of one of the classes (say A) needs to return an instance of another (say B) of these classes. I can't see an obvious way of constructing an instance of B from within C++ code. The constructors of new style classes require a PythonClassInstance* and it is not obvious to me how to create one of those.
After reading a good chunk of the PyCXX source code, I was able to write a 10 line function using type_object(), extension_object_new(), extension_object_init() and PythonClassObject::getCxxObject() which seems to work. (I can post if anyone wants it)
If anyone knows an easier way than using several undocumented functions that are not used in the examples, I would appreciate a reply.