[pypy-dev] cppyy: C++ bindings for PyPy

wlavrijsen at lbl.gov wlavrijsen at lbl.gov
Mon Apr 23 16:52:49 CEST 2012


Hi Alexander,

> An important question from userland - would it be benefitial to switch from
> SWIG to the new interface? When can that be done?

there are no many major differences between SWIG and this on the Python side
(nothing that can't be captured in a compatibility layer). I'm thinking of
such things like cvar that is needed in SWIG, but not in cppyy, and the use
of templates which need to be named in the .i's in SWIG but are have a more
"instantiable" syntax in cppyy (for when the Cling backend becomes available).
Also, Reflex can parse more code than can SWIG, so you'd have to be careful
in which direction you use things.

> Right now the main problem with SWIG is the object ownership, i.e. with pypy
> one has to set thisown=False for all objects to avoid crashes related to GC
> code. The problem occurs only for long-living objects though.

The GC and cppyy work fine for those objects clearly owned by PyPy. Of course,
if the C++ side takes ownership, that would need to be patched up "by hand" or
with a rule (if the C++ API is consistent).

> PS: I would have gladly tested an alpha-beta quality version of the lib (i 
> have some unittests for SWIG bindings, so they should work with new lib also
> i suppose), but I can not build pypy from sources, not enuf RAM =) Maybe
> someone could send me a build with new feature for testing?

What distro (in particular, 32b or 64b and which version of libssl)? I've
never distributed a binary version of PyPy, but could give it a try.

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


More information about the pypy-dev mailing list