Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r57641 - in trunk/libs/python: src/object test
From: rwgk_at_[hidden]
Date: 2009-11-13 15:48:26


Author: rwgk
Date: 2009-11-13 15:48:25 EST (Fri, 13 Nov 2009)
New Revision: 57641
URL: http://svn.boost.org/trac/boost/changeset/57641

Log:
boost.python: some make_tuple changed to boost::python::make_tuple for gcc 4.4 -std=c++0x compatibility; https://svn.boost.org/trac/boost/ticket/3584
Text files modified:
   trunk/libs/python/src/object/function_doc_signature.cpp | 10 ++++++----
   trunk/libs/python/test/pickle1.cpp | 3 +--
   trunk/libs/python/test/pickle2.cpp | 8 +++-----
   trunk/libs/python/test/pickle3.cpp | 20 ++++++++------------
   4 files changed, 18 insertions(+), 23 deletions(-)

Modified: trunk/libs/python/src/object/function_doc_signature.cpp
==============================================================================
--- trunk/libs/python/src/object/function_doc_signature.cpp (original)
+++ trunk/libs/python/src/object/function_doc_signature.cpp 2009-11-13 15:48:25 EST (Fri, 13 Nov 2009)
@@ -3,6 +3,9 @@
 // accompanying file LICENSE_1_0.txt or copy at
 // http://www.boost.org/LICENSE_1_0.txt)
 
+// boost::python::make_tuple below are for gcc 4.4 -std=c++0x compatibility
+// (Intel C++ 10 and 11 with -std=c++0x don't need the full qualification).
+
 #include <boost/python/converter/registrations.hpp>
 #include <boost/python/object/function_doc_signature.hpp>
 #include <boost/python/errors.hpp>
@@ -12,7 +15,6 @@
 
 #include <boost/python/detail/signature.hpp>
 
-
 #include <vector>
 
 namespace boost { namespace python { namespace objects {
@@ -228,7 +230,7 @@
         {
             return str(
                 "%s %s(%s%s%s%s)"
- % make_tuple
+ % boost::python::make_tuple // workaround, see top
                 ( ret_type
                     , f->m_name
                     , str(",").join(formal_params.slice(0,arity-n_overloads))
@@ -239,7 +241,7 @@
         }else{
             return str(
                 "%s(%s%s%s%s) -> %s"
- % make_tuple
+ % boost::python::make_tuple // workaround, see top
                 ( f->m_name
                     , str(",").join(formal_params.slice(0,arity-n_overloads))
                     , n_overloads ? (n_overloads!=arity?str(" [,"):str("[ ")) : str()
@@ -251,7 +253,7 @@
 
         return str(
             "%s %s(%s%s%s%s) %s"
- % make_tuple
+ % boost::python::make_tuple // workaround, see top
             ( cpp_types?ret_type:str("")
                 , f->m_name
                 , str(",").join(formal_params.slice(0,arity-n_overloads))

Modified: trunk/libs/python/test/pickle1.cpp
==============================================================================
--- trunk/libs/python/test/pickle1.cpp (original)
+++ trunk/libs/python/test/pickle1.cpp 2009-11-13 15:48:25 EST (Fri, 13 Nov 2009)
@@ -40,8 +40,7 @@
     boost::python::tuple
     getinitargs(const world& w)
     {
- using namespace boost::python;
- return make_tuple(w.get_country());
+ return boost::python::make_tuple(w.get_country());
     }
   };
 

Modified: trunk/libs/python/test/pickle2.cpp
==============================================================================
--- trunk/libs/python/test/pickle2.cpp (original)
+++ trunk/libs/python/test/pickle2.cpp 2009-11-13 15:48:25 EST (Fri, 13 Nov 2009)
@@ -52,16 +52,14 @@
     boost::python::tuple
     getinitargs(const world& w)
     {
- using namespace boost::python;
- return make_tuple(w.get_country());
+ return boost::python::make_tuple(w.get_country());
     }
 
     static
     boost::python::tuple
     getstate(const world& w)
     {
- using namespace boost::python;
- return make_tuple(w.get_secret_number());
+ return boost::python::make_tuple(w.get_secret_number());
     }
 
     static
@@ -77,7 +75,7 @@
               );
           throw_error_already_set();
         }
-
+
         long number = extract<long>(state[0]);
         if (number != 42)
             w.set_secret_number(number);

Modified: trunk/libs/python/test/pickle3.cpp
==============================================================================
--- trunk/libs/python/test/pickle3.cpp (original)
+++ trunk/libs/python/test/pickle3.cpp 2009-11-13 15:48:25 EST (Fri, 13 Nov 2009)
@@ -25,10 +25,6 @@
 #include <boost/python/extract.hpp>
 #include <boost/python/back_reference.hpp>
 
-#if BOOST_WORKAROUND(__SUNPRO_CC, BOOST_TESTED_AT(0x580)) || BOOST_WORKAROUND(BOOST_MSVC, BOOST_TESTED_AT(1500))
-# define make_tuple boost::python::make_tuple
-#endif
-
 namespace boost_python_test {
 
   // A friendly class.
@@ -53,18 +49,18 @@
     boost::python::tuple
     getinitargs(const world& w)
     {
- using namespace boost::python;
- return make_tuple(w.get_country());
+ return boost::python::make_tuple(w.get_country());
     }
 
     static
     boost::python::tuple
     getstate(boost::python::object w_obj)
     {
- using namespace boost::python;
- world const& w = extract<world const&>(w_obj)();
+ world const& w = boost::python::extract<world const&>(w_obj)();
 
- return make_tuple(w_obj.attr("__dict__"), w.get_secret_number());
+ return boost::python::make_tuple(
+ w_obj.attr("__dict__"),
+ w.get_secret_number());
     }
 
     static
@@ -73,7 +69,7 @@
     {
         using namespace boost::python;
         world& w = extract<world&>(w_obj)();
-
+
         if (len(state) != 2)
         {
           PyErr_SetObject(PyExc_ValueError,
@@ -82,11 +78,11 @@
               );
           throw_error_already_set();
         }
-
+
         // restore the object's __dict__
         dict d = extract<dict>(w_obj.attr("__dict__"))();
         d.update(state[0]);
-
+
         // restore the internal state of the C++ object
         long number = extract<long>(state[1]);
         if (number != 42)


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