Skip to content

Commit 022a5a1

Browse files
author
Ralf W. Grosse-Kunstleve
committed
Python 2.3b1 compatibility: LONG_LONG -> PY_LONG_LONG
[SVN r18337]
1 parent a39a834 commit 022a5a1

File tree

4 files changed

+23
-13
lines changed

4 files changed

+23
-13
lines changed

include/boost/python/converter/builtin_converters.hpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -103,8 +103,8 @@ BOOST_PYTHON_TO_INT(long)
103103
// using Python's macro instead of Boost's - we don't seem to get the
104104
// config right all the time.
105105
# ifdef HAVE_LONG_LONG
106-
BOOST_PYTHON_TO_PYTHON_BY_VALUE(signed LONG_LONG, PyLong_FromLongLong(x))
107-
BOOST_PYTHON_TO_PYTHON_BY_VALUE(unsigned LONG_LONG, PyLong_FromUnsignedLongLong(x))
106+
BOOST_PYTHON_TO_PYTHON_BY_VALUE(signed BOOST_PYTHON_LONG_LONG, PyLong_FromLongLong(x))
107+
BOOST_PYTHON_TO_PYTHON_BY_VALUE(unsigned BOOST_PYTHON_LONG_LONG, PyLong_FromUnsignedLongLong(x))
108108
# endif
109109

110110
# undef BOOST_TO_PYTHON_INT

include/boost/python/detail/wrap_python.hpp

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -155,3 +155,13 @@ typedef int pid_t;
155155
#elif _MSC_VER
156156
# pragma warning(disable:4786)
157157
#endif
158+
159+
#if defined(HAVE_LONG_LONG)
160+
# if defined(PY_LONG_LONG)
161+
# define BOOST_PYTHON_LONG_LONG PY_LONG_LONG
162+
# elif defined(LONG_LONG)
163+
# define BOOST_PYTHON_LONG_LONG LONG_LONG
164+
# else
165+
# error "HAVE_LONG_LONG defined but not PY_LONG_LONG or LONG_LONG"
166+
# endif
167+
#endif

src/converter/builtin_converters.cpp

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -171,15 +171,15 @@ namespace
171171

172172
struct long_long_rvalue_from_python : long_long_rvalue_from_python_base
173173
{
174-
static LONG_LONG extract(PyObject* intermediate)
174+
static BOOST_PYTHON_LONG_LONG extract(PyObject* intermediate)
175175
{
176176
if (PyInt_Check(intermediate))
177177
{
178178
return PyInt_AS_LONG(intermediate);
179179
}
180180
else
181181
{
182-
LONG_LONG result = PyLong_AsLongLong(intermediate);
182+
BOOST_PYTHON_LONG_LONG result = PyLong_AsLongLong(intermediate);
183183

184184
if (PyErr_Occurred())
185185
throw_error_already_set();
@@ -191,15 +191,15 @@ namespace
191191

192192
struct unsigned_long_long_rvalue_from_python : long_long_rvalue_from_python_base
193193
{
194-
static unsigned LONG_LONG extract(PyObject* intermediate)
194+
static unsigned BOOST_PYTHON_LONG_LONG extract(PyObject* intermediate)
195195
{
196196
if (PyInt_Check(intermediate))
197197
{
198-
return numeric_cast<unsigned LONG_LONG>(PyInt_AS_LONG(intermediate));
198+
return numeric_cast<unsigned BOOST_PYTHON_LONG_LONG>(PyInt_AS_LONG(intermediate));
199199
}
200200
else
201201
{
202-
unsigned LONG_LONG result = PyLong_AsUnsignedLongLong(intermediate);
202+
unsigned BOOST_PYTHON_LONG_LONG result = PyLong_AsUnsignedLongLong(intermediate);
203203

204204
if (PyErr_Occurred())
205205
throw_error_already_set();
@@ -350,8 +350,8 @@ void initialize_builtin_converters()
350350
// using Python's macro instead of Boost's - we don't seem to get the
351351
// config right all the time.
352352
# ifdef HAVE_LONG_LONG
353-
slot_rvalue_from_python<signed LONG_LONG,long_long_rvalue_from_python>();
354-
slot_rvalue_from_python<unsigned LONG_LONG,unsigned_long_long_rvalue_from_python>();
353+
slot_rvalue_from_python<signed BOOST_PYTHON_LONG_LONG,long_long_rvalue_from_python>();
354+
slot_rvalue_from_python<unsigned BOOST_PYTHON_LONG_LONG,unsigned_long_long_rvalue_from_python>();
355355
# endif
356356

357357
// floating types

test/test_builtin_converters.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -75,8 +75,8 @@ BOOST_PYTHON_MODULE(builtin_converters)
7575
// using Python's macro instead of Boost's - we don't seem to get the
7676
// config right all the time.
7777
#ifdef HAVE_LONG_LONG
78-
def("rewrap_value_long_long", by_value<LONG_LONG>::rewrap);
79-
def("rewrap_value_unsigned_long_long", by_value<unsigned LONG_LONG>::rewrap);
78+
def("rewrap_value_long_long", by_value<BOOST_PYTHON_LONG_LONG>::rewrap);
79+
def("rewrap_value_unsigned_long_long", by_value<unsigned BOOST_PYTHON_LONG_LONG>::rewrap);
8080
# endif
8181
def("rewrap_value_float", by_value<float>::rewrap);
8282
def("rewrap_value_double", by_value<double>::rewrap);
@@ -106,8 +106,8 @@ BOOST_PYTHON_MODULE(builtin_converters)
106106
// using Python's macro instead of Boost's - we don't seem to get the
107107
// config right all the time.
108108
# ifdef HAVE_LONG_LONG
109-
def("rewrap_const_reference_long_long", by_const_reference<LONG_LONG>::rewrap);
110-
def("rewrap_const_reference_unsigned_long_long", by_const_reference<unsigned LONG_LONG>::rewrap);
109+
def("rewrap_const_reference_long_long", by_const_reference<BOOST_PYTHON_LONG_LONG>::rewrap);
110+
def("rewrap_const_reference_unsigned_long_long", by_const_reference<unsigned BOOST_PYTHON_LONG_LONG>::rewrap);
111111
# endif
112112
def("rewrap_const_reference_float", by_const_reference<float>::rewrap);
113113
def("rewrap_const_reference_double", by_const_reference<double>::rewrap);

0 commit comments

Comments
 (0)