[pypy-dev] Compatibilidad with boost python

Amaury Forgeot d'Arc amauryfa at gmail.com
Fri Jun 7 10:59:17 CEST 2013


2013/6/6 Riccardo Rossi <rrossi at cimne.upc.edu>

> Dear Amaury,
>          first of all thank you for your answer. I think i could hack the
> boost to compile with a different python, however your last warning is
> actuall the answer i was interested in getting.
>
> if you tell me that the interface will be actually slower than in cpython,
> than most probably it will not fit my needs.
>
> i will keep monitoring your project (i really believe you do a very
> interesting job) in the hope the link to C/C++ will get better (or that
> boost_python will be ported based on cffi)
>

There are fundamental reasons why the CPython API is slow with PyPy
(one of them is that PyPy objects move in memory, so cannot be represented
as simple pointers)

Porting boost::python to cffi is... a challenging idea.
First, a cffi module is written in Python, when a boost::python module is
C++ code.
Then, cffi is currently designed to pass only simple types: int, float,
pointers, struct.
No C++ class instance, and no Python object.

A boost::python::object could be emulated with the help of ffi.new_handle(),
but I don't know whether this integrates easily with C++ memory management
(the "handle" object
needs to stay alive, and this can only be done from Python code)

It's worth exploring though -- and no specific PyPy knowledge is needed for
this.
Help is welcome!

-- 
Amaury Forgeot d'Arc
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/pypy-dev/attachments/20130607/594bd2ae/attachment.html>


More information about the pypy-dev mailing list