[pypy-dev] cppyy use case question

wlavrijsen at lbl.gov wlavrijsen at lbl.gov
Thu May 31 03:52:25 CEST 2012


Hi Alex,

> So, cpp_class acts as a container for python objects, and it does not need to
> know what kind of object is inside. I was able to make it work with pypy
> through basic C API, using SWIG and typemaps by mapping void* into PyObject*,
> but that is somewhat hackish. I am now thinking how would the same logic look
> with cppyy extension.

this should be supported directly (PyROOT does), but where in CPython handing
a PyObject* is trivial, in PyPy one has to be created. My best guess is that
the route would be cpyext to get such a PyObject*, then hand that over.

I don't think it can be hacked around (a void* argument will peel the contained
C++ object, which will fail, since it's a real Python object).

Identity preservation (on the return) should be easy, and the C++ side should
keep the refcount up for the proper duration.

Let me figure that one out. Is as good a reason as any to have some fun and do
some coding again for the first time in weeks. :P

> PS:
> building cppyy is pain in the ass... You guys seriously need to think about
> build logs =)

Sorry (but this is why at CERN we have a global file system (afs) and simply
install there for all users :) ) ... So, is there anything in the instructions
that was missing and needs to be added?

Best regards,
            Wim
-- 
WLavrijsen at lbl.gov    --    +1 (510) 486 6411    --    www.lavrijsen.net


More information about the pypy-dev mailing list