[C++-sig] boost::python for Python 3.0

Haoyu Bai divinekid at gmail.com
Mon Jun 1 14:06:20 CEST 2009


On Mon, Jun 1, 2009 at 7:41 PM, Alcides Viamontes Esquivel
<a.viamontes.esquivel at gmail.com> wrote:
> Dear all:
>
> I would like to know if there is any progress on the development of a
> version of boost::python for Python 3.0, the last activity that I can
> track on this is back to the first days of April; that includes
> mailing lists and the boost repository.
>
> I played a little with it and last night I succeeded in compiling
> boost::python for Python 3.0 and in running the first test
> (test_builtin_converters.py), but of course a lot have still to be
> done (the const char* and char* issue, among many ones...). I would
> like to know if there is somebody else working on this.
>
> Any suggestions appreciated.
>
> Alcides.
>

Hi Alcides,

Yes I'm working on py3k support as my GSoC project. And as you see,
the current situation is it can be compiled under Python 3, and have
some tests  passed.

But now I get stuck on the Python unicode string and const char*
conversion issue. In Python 2.x, the Python string -> const char*
conversion can be simply done by a lvalue conversion. But in Python 3,
the conversion path would be unicode -> (encoding to) bytes -> const
char*. This requires an rvalue conversion. Bit after reading the code
in extract.hpp, I found that since char* is a pointer, the conversion
must be done as a lvalue conversion. This is a short description of
the problem, please forgive me if it is not clear. :)

So I'm still reading the code about call policies and type converting,
hopefully I can state the problem clearer and even find out a solution
when I get more understanding about BPL internal.

Thanks for your interesting! :)

-- Haoyu Bai


More information about the Cplusplus-sig mailing list