[C++-sig] Python 2.3

Conan Brink conanb at STCG.net
Mon Aug 4 19:25:49 CEST 2003


Python 2.3 changed the name of LONG_LONG to PY_LONG_LONG.

Option 1:

I solved this in my local copy of 1.30.0 by checking the python version,
and if it is >= 2.3, I use PY_LONG_LONG, and if it is < 2.3, I use
LONG_LONG.

So my lines 103-106 of boost/python/converter/builtin_converters.hpp
have been replaced by the following eight lines (apologies if this lousy
mail client has messed up the formatting):

# ifdef HAVE_LONG_LONG
#  if PY_MAJOR_VERSION < 2 || PY_MAJOR_VERSION == 2 && PY_MINOR_VERSION
<= 2
BOOST_PYTHON_TO_PYTHON_BY_VALUE(signed LONG_LONG,
PyLong_FromLongLong(x))
BOOST_PYTHON_TO_PYTHON_BY_VALUE(unsigned LONG_LONG,
PyLong_FromUnsignedLongLong(x))
#  else
BOOST_PYTHON_TO_PYTHON_BY_VALUE(signed PY_LONG_LONG,
PyLong_FromLongLong(x))
BOOST_PYTHON_TO_PYTHON_BY_VALUE(unsigned PY_LONG_LONG,
PyLong_FromUnsigned
#  endif
# endif

Similar changes then become required in
libs/python/src/converter/builtin_converters.cpp and
libs/python/test/test_builtin_converters.cpp

Option 2:

You could #define LONG_LONG as PY_LONG_LONG if your python version is >=
2.3 (or, alternatively, #define PY_LONG_LONG to be LONG_LONG if your
version is < 2.3, and then also change all other occurrences of
LONG_LONG to PY_LONG_LONG).

Option 3:

The CVS version of Boost.Python introduces BOOST_PYTHON_LONG_LONG, which
then frees you from having to care about which version of Python you're
using (for this particular issue).

-Conan

-----Original Message-----
From: abeyer at uni-osnabrueck.de [mailto:abeyer at uni-osnabrueck.de] 
Sent: Monday, August 04, 2003 9:19 AM
To: c++-sig at python.org
Subject: [C++-sig] Python 2.3

I am trying to use Boost.Python 1.30.0 with Python 2.3 under Windows XP.
I have successfully built the Boost.Python lib with MinGW for Python
2.2.3, but I failed for 2.3. Of course, I have set the PYTHON_ROOT and
PYTHON_VERSION variables for the new version.
Has anyone else encountered problems when compiling Boost.Python for
Python 2.3?

Here are the details (using Bjam 3.1.4):

g++  -c -Wall -ftemplate-depth-100  -DBOOST_PYTHON_DYNAMIC_LIB
-DBOOST_PYTHON_SOURCE  -g -O0 -fn
o-inline   -I"..\..\..\libs\python\build"  -isystem "C:\boost_1_30_0"
-isystem "C:\Python23\include"  -o
"..\..\..\libs\python\build\bin\boost_python.dll\mingw\debug\runtime-lin
k-dynamic\numeric.obj"
 "..\..\..\libs\python\build\../src\numeric.cpp"

 mingw-C++-action
..\..\..\libs\python\build\bin\boost_python.dll\mingw\debug\runtime-link
-dynamic\numeric.obj
In file included from
C:/boost_1_30_0/boost/python/converter/arg_to_python.hpp:18,
                 from C:/boost_1_30_0/boost/python/call.hpp:14,
                 from C:/boost_1_30_0/boost/python/object_core.hpp:14,
                 from C:/boost_1_30_0/boost/python/object.hpp:9,
                 from C:/boost_1_30_0/boost/python/tuple.hpp:9,
                 from C:/boost_1_30_0/boost/python/numeric.hpp:9,
                 from ../../../libs/python/src/numeric.cpp:7:
C:/boost_1_30_0/boost/python/converter/builtin_converters.hpp:106: parse
error before `&' token
C:/boost_1_30_0/boost/python/converter/builtin_converters.hpp:106:
syntax
error before `&' token
C:/boost_1_30_0/boost/python/converter/builtin_converters.hpp:106: parse
error before `const'
C:/boost_1_30_0/boost/python/converter/builtin_converters.hpp:106:
syntax
error before `const'
C:/boost_1_30_0/boost/python/converter/builtin_converters.hpp:106: parse
error before `>' token

[... and so on ...]



_______________________________________________
C++-sig mailing list
C++-sig at python.org
http://mail.python.org/mailman/listinfo/c++-sig




This message contains information that may be confidential and privileged.  Unless you are the addressee (or authorized to receive messages for the addressee), you may not use, copy, or disclose to anyone the message or any information contained in the message.  If you have received the message in error, please advise the sender by reply e-mail and delete the message.  Nothing in this message should be interpreted as a digital or electronic signature that can be used to authenticate a contract or any other legal document.




More information about the Cplusplus-sig mailing list