GNOME Bugzilla – Bug 567144
Use boost::python instead of the Python C API.
Last modified: 2010-03-09 15:18:55 UTC
We have a Glom Python module implemented with the Python C API. I would like to see how that looks when reimplemented with boost::python. If that looks nicer then it would help us to expand our python API.
Created attachment 129208 [details] [review] glom_boost_python.patch This is an additional attempt to use boost::python for just the execuction of Python functions, not yet using boost::python to implement our Python module. However, I can't seem to instantiate the glom.Record type, which we do with PyObject_Call(type), with the C API.
Created attachment 129320 [details] [review] glom_boost_python_with_module.patch This one also uses boost::python to create the Glom python module. It certainly looks much nicer, though it is almost totally untested. The [] subscripting does not work, and I'm not even sure that this is how it should be implemented. Also we should probably use boost::python::object where we are now still using PyObject*. Note that the "self = this" variables are just to keep the code changes to a minimum to make the patch readable. Later we will remove them. Anyway, the first patch should be fixed first.
Created attachment 129433 [details] [review] glom_boost_python_with_module2.patch No progress on the embedded part, but the module is much better now, though the map seems to be NULL when we call PyGlomRecord::getitem().
This is now done.