diff --git a/include/boost/python/converter/builtin_converters.hpp b/include/boost/python/converter/builtin_converters.hpp index d8bce16b..aebfd459 100644 --- a/include/boost/python/converter/builtin_converters.hpp +++ b/include/boost/python/converter/builtin_converters.hpp @@ -90,10 +90,12 @@ BOOST_PYTHON_TO_INT(char) BOOST_PYTHON_TO_INT(short) BOOST_PYTHON_TO_INT(int) BOOST_PYTHON_TO_INT(long) - -# ifdef BOOST_HAS_LONG_LONG -BOOST_PYTHON_TO_PYTHON_BY_VALUE(signed long long, PyLong_FromLongLong(x)) -BOOST_PYTHON_TO_PYTHON_BY_VALUE(unsigned long long, PyLong_FromUnsignedLongLong(x)) + +// using Python's macro instead of Boost's - we don't seem to get the +// config right all the time. +# ifdef HAVE_LONG_LONG +BOOST_PYTHON_TO_PYTHON_BY_VALUE(signed LONG_LONG, PyLong_FromLongLong(x)) +BOOST_PYTHON_TO_PYTHON_BY_VALUE(unsigned LONG_LONG, PyLong_FromUnsignedLongLong(x)) # endif # undef BOOST_TO_PYTHON_INT diff --git a/include/boost/python/type_id.hpp b/include/boost/python/type_id.hpp index 11c15120..cf818fe3 100755 --- a/include/boost/python/type_id.hpp +++ b/include/boost/python/type_id.hpp @@ -6,6 +6,7 @@ #ifndef TYPE_ID_DWA2002517_HPP # define TYPE_ID_DWA2002517_HPP +# include # include # include # include @@ -78,7 +79,9 @@ inline type_info type_id(boost::type*) \ BOOST_PYTHON_SIGNED_INTEGRAL_TYPE_ID(short) BOOST_PYTHON_SIGNED_INTEGRAL_TYPE_ID(int) BOOST_PYTHON_SIGNED_INTEGRAL_TYPE_ID(long) -# ifdef BOOST_HAS_LONG_LONG +// using Python's macro instead of Boost's - we don't seem to get the +// config right all the time. +# ifdef HAVE_LONG_LONG BOOST_PYTHON_SIGNED_INTEGRAL_TYPE_ID(long long) # endif # undef BOOST_PYTHON_SIGNED_INTEGRAL_TYPE_ID diff --git a/src/converter/builtin_converters.cpp b/src/converter/builtin_converters.cpp index daff89d3..1d8efa29 100644 --- a/src/converter/builtin_converters.cpp +++ b/src/converter/builtin_converters.cpp @@ -98,7 +98,9 @@ namespace } }; -#ifdef BOOST_HAS_LONG_LONG +// using Python's macro instead of Boost's - we don't seem to get the +// config right all the time. +#ifdef HAVE_LONG_LONG // A SlotPolicy for extracting long long types from Python objects struct long_long_rvalue_from_python_base { @@ -126,7 +128,7 @@ namespace struct long_long_rvalue_from_python : long_long_rvalue_from_python_base { - static long long extract(PyObject* intermediate) + static LONG_LONG extract(PyObject* intermediate) { if (PyInt_Check(intermediate)) { @@ -134,11 +136,11 @@ namespace } if (PyFloat_Check(intermediate)) { - return numeric_cast(PyFloat_AS_DOUBLE(intermediate)); + return numeric_cast(PyFloat_AS_DOUBLE(intermediate)); } else { - long long result = PyLong_AsLongLong(intermediate); + LONG_LONG result = PyLong_AsLongLong(intermediate); if (PyErr_Occurred()) throw_error_already_set(); @@ -150,19 +152,19 @@ namespace struct unsigned_long_long_rvalue_from_python : long_long_rvalue_from_python_base { - static unsigned long long extract(PyObject* intermediate) + static unsigned LONG_LONG extract(PyObject* intermediate) { if (PyInt_Check(intermediate)) { - return numeric_cast(PyInt_AS_LONG(intermediate)); + return numeric_cast(PyInt_AS_LONG(intermediate)); } if (PyFloat_Check(intermediate)) { - return numeric_cast(PyFloat_AS_DOUBLE(intermediate)); + return numeric_cast(PyFloat_AS_DOUBLE(intermediate)); } else { - unsigned long long result = PyLong_AsUnsignedLongLong(intermediate); + unsigned LONG_LONG result = PyLong_AsUnsignedLongLong(intermediate); if (PyErr_Occurred()) throw_error_already_set(); @@ -347,9 +349,11 @@ void initialize_builtin_converters() REGISTER_INT_CONVERTERS2(int); REGISTER_INT_CONVERTERS2(long); -# ifdef BOOST_HAS_LONG_LONG - slot_rvalue_from_python(); - slot_rvalue_from_python(); +// using Python's macro instead of Boost's - we don't seem to get the +// config right all the time. +# ifdef HAVE_LONG_LONG + slot_rvalue_from_python(); + slot_rvalue_from_python(); # endif // floating types diff --git a/test/Jamfile b/test/Jamfile index 5d0118d3..e4cba386 100644 --- a/test/Jamfile +++ b/test/Jamfile @@ -82,38 +82,38 @@ if $(TEST_BIENSTMAN_NON_BUGS) } # --- unit tests of library components --- + +local UNIT_TEST_PROPERTIES = [ difference $(PYTHON_PROPERTIES) : BOOST_PYTHON_DYNAMIC_LIB ] BOOST_PYTHON_STATIC_LIB ; + run indirect_traits_test.cpp ; run destroy_test.cpp ; -run pointer_type_id_test.cpp ; +run pointer_type_id_test.cpp : : : $(UNIT_TEST_PROPERTIES) ; run member_function_cast.cpp ; run bases.cpp ; run if_else.cpp ; run pointee.cpp ; run result.cpp ; compile string_literal.cpp ; -compile borrowed.cpp : $(PYTHON_PROPERTIES) ; -compile object_manager.cpp : $(PYTHON_PROPERTIES) ; +compile borrowed.cpp : $(UNIT_TEST_PROPERTIES) ; +compile object_manager.cpp : $(UNIT_TEST_PROPERTIES) ; run upcast.cpp : # command-line args : # input files - : [ difference $(PYTHON_PROPERTIES) : BOOST_PYTHON_DYNAMIC_LIB ] - BOOST_PYTHON_STATIC_LIB + : $(UNIT_TEST_PROPERTIES) ; run select_holder.cpp : # command-line args : # input files - : [ difference $(PYTHON_PROPERTIES) : BOOST_PYTHON_DYNAMIC_LIB ] - BOOST_PYTHON_STATIC_LIB + : $(UNIT_TEST_PROPERTIES) ; run select_from_python_test.cpp ../src/converter/type_id.cpp : # command-line args : # input files - : [ difference $(PYTHON_PROPERTIES) : BOOST_PYTHON_DYNAMIC_LIB ] - BOOST_PYTHON_STATIC_LIB + : $(UNIT_TEST_PROPERTIES) ; if $(TEST_EXPECTED_FAILURES) diff --git a/test/test_builtin_converters.cpp b/test/test_builtin_converters.cpp index bf7d991e..63b71669 100644 --- a/test/test_builtin_converters.cpp +++ b/test/test_builtin_converters.cpp @@ -9,6 +9,7 @@ #include #include #include +#include template struct by_value @@ -70,9 +71,11 @@ BOOST_PYTHON_MODULE_INIT(builtin_converters) .def("rewrap_value_unsigned_short", by_value::rewrap) .def("rewrap_value_long", by_value::rewrap) .def("rewrap_value_unsigned_long", by_value::rewrap) -#ifdef BOOST_HAS_LONG_LONG - .def("rewrap_value_long_long", by_value::rewrap) - .def("rewrap_value_unsigned_long_long", by_value::rewrap) +// using Python's macro instead of Boost's - we don't seem to get the +// config right all the time. +#ifdef HAVE_LONG_LONG + .def("rewrap_value_long_long", by_value::rewrap) + .def("rewrap_value_unsigned_long_long", by_value::rewrap) #endif .def("rewrap_value_float", by_value::rewrap) .def("rewrap_value_double", by_value::rewrap) @@ -99,9 +102,11 @@ BOOST_PYTHON_MODULE_INIT(builtin_converters) .def("rewrap_const_reference_unsigned_short", by_const_reference::rewrap) .def("rewrap_const_reference_long", by_const_reference::rewrap) .def("rewrap_const_reference_unsigned_long", by_const_reference::rewrap) -#ifdef BOOST_HAS_LONG_LONG - .def("rewrap_const_reference_long_long", by_const_reference::rewrap) - .def("rewrap_const_reference_unsigned_long_long", by_const_reference::rewrap) +// using Python's macro instead of Boost's - we don't seem to get the +// config right all the time. +#ifdef HAVE_LONG_LONG + .def("rewrap_const_reference_long_long", by_const_reference::rewrap) + .def("rewrap_const_reference_unsigned_long_long", by_const_reference::rewrap) #endif .def("rewrap_const_reference_float", by_const_reference::rewrap) .def("rewrap_const_reference_double", by_const_reference::rewrap)