Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r63937 - in branches/release: boost/python boost/python/converter boost/python/object libs/python libs/python/build libs/python/doc/v2 libs/python/src/converter libs/python/test
From: rwgk_at_[hidden]
Date: 2010-07-12 18:29:42


Author: rwgk
Date: 2010-07-12 18:29:41 EDT (Mon, 12 Jul 2010)
New Revision: 63937
URL: http://svn.boost.org/trac/boost/changeset/63937

Log:
merging current boost/python and libs/python from trunk into release branch
Properties modified:
   branches/release/boost/python/ (props changed)
   branches/release/libs/python/ (props changed)
   branches/release/libs/python/doc/v2/args.html (props changed)
   branches/release/libs/python/doc/v2/return_internal_reference.html (props changed)
Text files modified:
   branches/release/boost/python/converter/builtin_converters.hpp | 27 ++++++++++++++++++++++++---
   branches/release/boost/python/converter/registry.hpp | 2 +-
   branches/release/boost/python/exception_translator.hpp | 2 +-
   branches/release/boost/python/module_init.hpp | 20 +++++++++++---------
   branches/release/boost/python/object/make_instance.hpp | 3 ---
   branches/release/libs/python/build/Jamfile.v2 | 23 +++++++++++++++--------
   branches/release/libs/python/src/converter/registry.cpp | 4 ++--
   branches/release/libs/python/test/Jamfile.v2 | 13 +++++++++----
   8 files changed, 63 insertions(+), 31 deletions(-)

Modified: branches/release/boost/python/converter/builtin_converters.hpp
==============================================================================
--- branches/release/boost/python/converter/builtin_converters.hpp (original)
+++ branches/release/boost/python/converter/builtin_converters.hpp 2010-07-12 18:29:41 EDT (Mon, 12 Jul 2010)
@@ -122,9 +122,30 @@
 BOOST_PYTHON_TO_INT(int)
 BOOST_PYTHON_TO_INT(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
+# if defined(_MSC_VER) && defined(_WIN64)
+/* Under 64-bit Windows std::size_t is "unsigned long long". To avoid
+ getting a Python long for each std::size_t the value is checked before
+ the conversion. A std::size_t is converted to a simple Python int
+ if possible; a Python long appears only if the value is too small or
+ too large to fit into a simple int. */
+BOOST_PYTHON_TO_PYTHON_BY_VALUE(
+ signed BOOST_PYTHON_LONG_LONG,
+ ( x < static_cast<signed BOOST_PYTHON_LONG_LONG>(
+ (std::numeric_limits<long>::min)())
+ || x > static_cast<signed BOOST_PYTHON_LONG_LONG>(
+ (std::numeric_limits<long>::max)()))
+ ? ::PyLong_FromLongLong(x)
+ : ::PyInt_FromLong(static_cast<long>(x)), &PyInt_Type)
+BOOST_PYTHON_TO_PYTHON_BY_VALUE(
+ unsigned BOOST_PYTHON_LONG_LONG,
+ x > static_cast<unsigned BOOST_PYTHON_LONG_LONG>(
+ (std::numeric_limits<long>::max)())
+ ? ::PyLong_FromUnsignedLongLong(x)
+ : ::PyInt_FromLong(static_cast<long>(x)), &PyInt_Type)
+//
+# elif defined(HAVE_LONG_LONG) // using Python's macro instead of Boost's
+ // - we don't seem to get the config right
+ // all the time.
 BOOST_PYTHON_TO_PYTHON_BY_VALUE(signed BOOST_PYTHON_LONG_LONG, ::PyLong_FromLongLong(x), &PyLong_Type)
 BOOST_PYTHON_TO_PYTHON_BY_VALUE(unsigned BOOST_PYTHON_LONG_LONG, ::PyLong_FromUnsignedLongLong(x), &PyLong_Type)
 # endif

Modified: branches/release/boost/python/converter/registry.hpp
==============================================================================
--- branches/release/boost/python/converter/registry.hpp (original)
+++ branches/release/boost/python/converter/registry.hpp 2010-07-12 18:29:41 EDT (Mon, 12 Jul 2010)
@@ -30,7 +30,7 @@
   BOOST_PYTHON_DECL void insert(to_python_function_t, type_info, PyTypeObject const* (*to_python_target_type)() = 0);
 
   // Insert an lvalue from_python converter
- BOOST_PYTHON_DECL void insert(void* (*convert)(PyObject*), type_info, PyTypeObject const* (*expected_pytype)() = 0);
+ BOOST_PYTHON_DECL void insert(convertible_function, type_info, PyTypeObject const* (*expected_pytype)() = 0);
 
   // Insert an rvalue from_python converter
   BOOST_PYTHON_DECL void insert(

Modified: branches/release/boost/python/exception_translator.hpp
==============================================================================
--- branches/release/boost/python/exception_translator.hpp (original)
+++ branches/release/boost/python/exception_translator.hpp 2010-07-12 18:29:41 EDT (Mon, 12 Jul 2010)
@@ -18,7 +18,7 @@
 void register_exception_translator(Translate translate, boost::type<ExceptionType>* = 0)
 {
     detail::register_exception_handler(
- bind<bool>(detail::translate_exception<ExceptionType,Translate>(), _1, _2, translate)
+ boost::bind<bool>(detail::translate_exception<ExceptionType,Translate>(), _1, _2, translate)
         );
 }
 

Modified: branches/release/boost/python/module_init.hpp
==============================================================================
--- branches/release/boost/python/module_init.hpp (original)
+++ branches/release/boost/python/module_init.hpp 2010-07-12 18:29:41 EDT (Mon, 12 Jul 2010)
@@ -6,6 +6,8 @@
 # define MODULE_INIT_DWA20020722_HPP
 
 # include <boost/python/detail/prefix.hpp>
+# include <boost/preprocessor/cat.hpp>
+# include <boost/preprocessor/stringize.hpp>
 
 # ifndef BOOST_PYTHON_MODULE_INIT
 
@@ -18,41 +20,41 @@
 # if PY_VERSION_HEX >= 0x03000000
 
 # define _BOOST_PYTHON_MODULE_INIT(name) \
-PyObject* PyInit_##name() \
+ PyObject* BOOST_PP_CAT (PyInit_,name)() \
 { \
     return boost::python::detail::init_module( \
- #name,&init_module_##name); \
+ BOOST_PP_STRINGIZE(name),&BOOST_PP_CAT(init_module_,name)); \
 } \
-void init_module_##name()
+ void BOOST_PP_CAT(init_module_,name)()
 
 # else
 
 # define _BOOST_PYTHON_MODULE_INIT(name) \
-void init##name() \
+ void BOOST_PP_CAT(init,name)() \
 { \
     boost::python::detail::init_module( \
- #name,&init_module_##name); \
+ BOOST_PP_STRINGIZE(name),&BOOST_PP_CAT(init_module_,name)); \
 } \
-void init_module_##name()
+ void BOOST_PP_CAT(init_module_,name)()
 
 # endif
 
 # if (defined(_WIN32) || defined(__CYGWIN__)) && !defined(BOOST_PYTHON_STATIC_MODULE)
 
 # define BOOST_PYTHON_MODULE_INIT(name) \
-void init_module_##name(); \
+ void BOOST_PP_CAT(init_module_,name)(); \
 extern "C" __declspec(dllexport) _BOOST_PYTHON_MODULE_INIT(name)
 
 # elif BOOST_PYTHON_USE_GCC_SYMBOL_VISIBILITY
 
 # define BOOST_PYTHON_MODULE_INIT(name) \
-void init_module_##name(); \
+ void BOOST_PP_CAT(init_module_,name)(); \
 extern "C" __attribute__ ((visibility("default"))) _BOOST_PYTHON_MODULE_INIT(name)
 
 # else
 
 # define BOOST_PYTHON_MODULE_INIT(name) \
-void init_module_##name(); \
+ void BOOST_PP_CAT(init_module_,name)(); \
 extern "C" _BOOST_PYTHON_MODULE_INIT(name)
 
 # endif

Modified: branches/release/boost/python/object/make_instance.hpp
==============================================================================
--- branches/release/boost/python/object/make_instance.hpp (original)
+++ branches/release/boost/python/object/make_instance.hpp 2010-07-12 18:29:41 EDT (Mon, 12 Jul 2010)
@@ -10,10 +10,7 @@
 # include <boost/python/converter/registered.hpp>
 # include <boost/python/detail/decref_guard.hpp>
 # include <boost/python/detail/none.hpp>
-# include <boost/type_traits/is_class.hpp>
 # include <boost/type_traits/is_union.hpp>
-# include <boost/mpl/assert.hpp>
-# include <boost/mpl/or.hpp>
 
 namespace boost { namespace python { namespace objects {
 

Modified: branches/release/libs/python/build/Jamfile.v2
==============================================================================
--- branches/release/libs/python/build/Jamfile.v2 (original)
+++ branches/release/libs/python/build/Jamfile.v2 2010-07-12 18:29:41 EDT (Mon, 12 Jul 2010)
@@ -14,14 +14,20 @@
     # Attempt default configuration of python
     import toolset : using ;
     using python ;
-
- if ! [ python.configured ]
- {
- ECHO "WARNING: No python installation configured and autoconfiguration" ;
- ECHO " failed. See http://www.boost.org/libs/python/doc/building.html" ;
- ECHO " for configuration instructions or pass --without-python to" ;
- ECHO " suppress this message and silently skip all Boost.Python targets" ;
- }
+}
+
+if [ python.configured ] || ( --without-python in [ modules.peek : ARGV ] )
+{
+ alias config-warning ;
+}
+else
+{
+ message config-warning
+ : "warning: No python installation configured and autoconfiguration"
+ : "note: failed. See http://www.boost.org/libs/python/doc/building.html"
+ : "note: for configuration instructions or pass --without-python to"
+ : "note: suppress this message and silently skip all Boost.Python targets"
+ ;
 }
 
 rule find-py3-version
@@ -122,6 +128,7 @@
             # as it's not possible anyway, and to cause dependents to
             # fail to build
             [ unless [ python.configured ] : <build>no ]
+ <dependency>config-warning
 
             <python-debugging>on:<define>BOOST_DEBUG_PYTHON
             [ cond $(is-py3) : <python>$(py3-version) ]

Modified: branches/release/libs/python/src/converter/registry.cpp
==============================================================================
--- branches/release/libs/python/src/converter/registry.cpp (original)
+++ branches/release/libs/python/src/converter/registry.cpp 2010-07-12 18:29:41 EDT (Mon, 12 Jul 2010)
@@ -243,7 +243,7 @@
   }
 
   // Insert an rvalue from_python converter
- void insert(void* (*convertible)(PyObject*)
+ void insert(convertible_function convertible
               , constructor_function construct
               , type_info key
               , PyTypeObject const* (*exp_pytype)())
@@ -261,7 +261,7 @@
   }
 
   // Insert an rvalue from_python converter
- void push_back(void* (*convertible)(PyObject*)
+ void push_back(convertible_function convertible
               , constructor_function construct
               , type_info key
               , PyTypeObject const* (*exp_pytype)())

Modified: branches/release/libs/python/test/Jamfile.v2
==============================================================================
--- branches/release/libs/python/test/Jamfile.v2 (original)
+++ branches/release/libs/python/test/Jamfile.v2 2010-07-12 18:29:41 EDT (Mon, 12 Jul 2010)
@@ -37,6 +37,13 @@
     return [ compile-fail $(sources) /boost/python//boost_python ] ;
 }
 
+rule require-windows ( properties * )
+{
+ if ! <target-os>windows in $(properties)
+ {
+ return <build>no ;
+ }
+}
 
 test-suite python
   :
@@ -184,10 +191,8 @@
 # bpl-test bienstman5 ;
 # }
 
-# XXX disabled on release branch only,
-# XXX to avoid failures on platforms other than Windows
-# [ bpl-test calling_conventions ]
-# [ bpl-test calling_conventions_mf ]
+[ bpl-test calling_conventions : : <conditional>@require-windows ]
+[ bpl-test calling_conventions_mf : : <conditional>@require-windows ]
 
 # --- unit tests of library components ---
 


Boost-Commit list run by bdawes at acm.org, david.abrahams at rcn.com, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk