[C++-sig] builtin_converters.hpp using outdated API on win64 builds

Austin Bingham austin.bingham at gmail.com
Thu Dec 23 13:22:47 CET 2010


On Thu, Dec 23, 2010 at 12:49 PM, Ralf W. Grosse-Kunstleve
<rwgk at yahoo.com> wrote:
> ----- Original Message ----
>
>> I'm currently trying to build boost-1.45 against python-3.1.3 on  win64
>> (visual studio 2009 sp1). This build is failing  because
>> boost/python/converter/builtin_converters.hpp is using APIs that  have
>> been removed from python3 without checking the python version;  at
>> lines 138 and 144 PyInt_FromLong is being used.
>>
>> If I understand  what's going in that code, the fix is to update line
>> 125 to check the python  version. I think we can just add:
>>
>>   && PY_VERSION_HEX <  0x03000000
>>
>> to the preprocessor conditional.
>>
>> I've made this change  locally, and it seems to fix things. Does this
>> seem like the correct fix?
>
> Did you test what happens when you have a function returning a size_t?
> E.g.
>
> std::size_t dummy() { return 123; }
>
> def("dummy", dummy);
>
> In Python3, what is the Python type you get?
> In Python2 it is 123L without the special code for WIN64.

I haven't directly tested it, but as I understand things there is only
one built-in integral type (int) in python3:

   http://docs.python.org/release/3.0.1/whatsnew/3.0.html#integers

If/when I get a chance, I'll try to answer this question a bit more
authoritatively. However, it seems pretty clear to me that size_t must
get translated to and int in python3.

Austin


More information about the Cplusplus-sig mailing list