diff --git a/build/Jamfile b/build/Jamfile index d597d055..eeb38d64 100644 --- a/build/Jamfile +++ b/build/Jamfile @@ -132,6 +132,7 @@ rule boost-python # standard requirements $(BOOST_PYTHON_INCLUDES) <*>$(PYTHON_LIB_PATH) + <*>$(PYTHON_LIB_PATH)/python22.lib <*>$(PYTHON_LIBS) $(PYTHON_PROPERTIES) diff --git a/include/boost/python/conversions.hpp b/include/boost/python/conversions.hpp index cf753e2d..c1a7d390 100644 --- a/include/boost/python/conversions.hpp +++ b/include/boost/python/conversions.hpp @@ -74,17 +74,17 @@ inline void xdecref_impl(PyObject* p) { Py_XDECREF(p); } template inline void decref(T* p) { - char* const raw_p = reinterpret_cast(p); - char* const p_base = raw_p - offsetof(PyObject, ob_refcnt); - decref_impl(reinterpret_cast(p_base)); + char* const raw_p = reinterpret_cast(p); + char* const p_base = raw_p - offsetof(PyObject, ob_refcnt); + decref_impl(reinterpret_cast(p_base)); } template inline void xdecref(T* p) { - char* const raw_p = reinterpret_cast(p); - char* const p_base = raw_p - offsetof(PyObject, ob_refcnt); - xdecref_impl(reinterpret_cast(p_base)); + char* const raw_p = reinterpret_cast(p); + char* const p_base = raw_p - offsetof(PyObject, ob_refcnt); + xdecref_impl(reinterpret_cast(p_base)); } namespace detail { @@ -294,22 +294,22 @@ inline PyObject* to_python(float f) inline PyObject* to_python(long l) { - return PyInt_FromLong(l); + return PyInt_FromLong(l); } inline PyObject* to_python(int x) { - return PyInt_FromLong(x); + return PyInt_FromLong(x); } inline PyObject* to_python(short x) { - return PyInt_FromLong(x); + return PyInt_FromLong(x); } inline PyObject* to_python(bool b) { - return PyInt_FromLong(b); + return PyInt_FromLong(b); } inline PyObject* to_python(void) @@ -319,7 +319,7 @@ inline PyObject* to_python(void) inline PyObject* to_python(const char* s) { - return PyString_FromString(s); + return PyString_FromString(s); } inline std::string from_python(PyObject* p, boost::python::type) diff --git a/include/boost/python/detail/base_object.hpp b/include/boost/python/detail/base_object.hpp index cf6bb528..19715876 100644 --- a/include/boost/python/detail/base_object.hpp +++ b/include/boost/python/detail/base_object.hpp @@ -48,7 +48,7 @@ base_object::base_object(PyTypeObject* type_obj) #if !defined(_MSC_VER) || defined(__STLPORT) std:: #endif - memset(bp, 0, sizeof(base_python_type)); + memset(bp, 0, sizeof(base_python_type)); Py_INCREF(type_obj); PyObject_INIT(bp, type_obj); } diff --git a/include/boost/python/detail/functions.hpp b/include/boost/python/detail/functions.hpp index 16b8e16d..eff05d65 100644 --- a/include/boost/python/detail/functions.hpp +++ b/include/boost/python/detail/functions.hpp @@ -59,13 +59,13 @@ class function : public python_object template struct wrapped_function_pointer : function { - typedef F ptr_fun; // pointer-to--function or pointer-to-member-function - - wrapped_function_pointer(ptr_fun pf) + typedef F ptr_fun; // pointer-to--function or pointer-to-member-function + + wrapped_function_pointer(ptr_fun pf) : m_pf(pf) {} private: - PyObject* do_call(PyObject* args, PyObject* keywords) const + PyObject* do_call(PyObject* args, PyObject* keywords) const { // This is where the boundary between the uniform Python function // interface and the statically-checked C++ function interface is @@ -77,7 +77,7 @@ struct wrapped_function_pointer : function { return typeid(F).name(); } private: - const ptr_fun m_pf; + const ptr_fun m_pf; }; // raw_arguments_function @@ -87,13 +87,13 @@ struct wrapped_function_pointer : function template struct raw_arguments_function : function { - typedef Ret (*ptr_fun)(Args, Keywords); - - raw_arguments_function(ptr_fun pf) + typedef Ret (*ptr_fun)(Args, Keywords); + + raw_arguments_function(ptr_fun pf) : m_pf(pf) {} private: - PyObject* do_call(PyObject* args, PyObject* keywords) const + PyObject* do_call(PyObject* args, PyObject* keywords) const { ref dict(keywords ? ref(keywords, ref::increment_count) : @@ -108,7 +108,7 @@ struct raw_arguments_function : function { return typeid(ptr_fun).name(); } private: - const ptr_fun m_pf; + const ptr_fun m_pf; }; // virtual_function<> -- @@ -127,19 +127,19 @@ template class virtual_function : public function { public: - virtual_function(V virtual_function_ptr, D default_implementation) + virtual_function(V virtual_function_ptr, D default_implementation) : m_virtual_function_ptr(virtual_function_ptr), m_default_implementation(default_implementation) {} private: - PyObject* do_call(PyObject* args, PyObject* keywords) const; + PyObject* do_call(PyObject* args, PyObject* keywords) const; const char* description() const { return typeid(V).name(); } private: - const V m_virtual_function_ptr; + const V m_virtual_function_ptr; const D m_default_implementation; }; @@ -160,7 +160,7 @@ template inline function* new_wrapped_function(F pmf) { // Deduce the return type and pass it off to the helper function above - return new_wrapped_function_aux(return_value(pmf), pmf); + return new_wrapped_function_aux(return_value(pmf), pmf); } template @@ -220,7 +220,7 @@ class bound_function : public python_object private: // data members for allocation/deallocation optimization bound_function* m_free_list_link; - static bound_function* free_list; + static bound_function* free_list; }; // Special functions designed to access data members of a wrapped C++ object. diff --git a/include/boost/python/detail/wrap_python.hpp b/include/boost/python/detail/wrap_python.hpp index b7a47513..373bbde4 100644 --- a/include/boost/python/detail/wrap_python.hpp +++ b/include/boost/python/detail/wrap_python.hpp @@ -90,5 +90,9 @@ typedef int pid_t; #if !defined(PY_MAJOR_VERSION) || PY_MAJOR_VERSION < 2 # define PyObject_INIT(op, typeobj) \ - ( (op)->ob_type = (typeobj), _Py_NewReference((PyObject *)(op)), (op) ) + ( (op)->ob_type = (typeobj), _Py_NewReference((PyObject *)(op)), (op) ) +#endif + +#ifdef __MWERKS__ +# pragma warn_possunwant off #endif diff --git a/include/boost/python/reference.hpp b/include/boost/python/reference.hpp index a1585099..4eb9ad51 100644 --- a/include/boost/python/reference.hpp +++ b/include/boost/python/reference.hpp @@ -42,31 +42,31 @@ BOOST_PYTHON_IMPORT_CONVERSION(py_ptr_conversions); template class reference - : public py_ptr_conversions, T> + : public py_ptr_conversions, T> { public: typedef T value_type; - reference(const reference& rhs) - : m_p(rhs.m_p) - { - Py_XINCREF(object()); - } + reference(const reference& rhs) + : m_p(rhs.m_p) + { + Py_XINCREF(object()); + } #if !defined(BOOST_MSVC6_OR_EARLIER) - template - reference(const reference& rhs) - : m_p(rhs.object()) - { - Py_XINCREF(object()); - } + template + reference(const reference& rhs) + : m_p(rhs.object()) + { + Py_XINCREF(object()); + } #endif - reference() : m_p(0) {} + reference() : m_p(0) {} // These are two ways of spelling the same thing, that we need to increment // the reference count on the pointer when we're initialized. - enum increment_count_t { increment_count }; + enum increment_count_t { increment_count }; enum allow_null { null_ok }; @@ -77,7 +77,7 @@ public: template reference(T2* x, increment_count_t) : m_p(expect_non_null(x)) { Py_INCREF(object()); } - + template reference(T2* x, allow_null) : m_p(x) {} @@ -85,49 +85,49 @@ public: template reference(T2* x, allow_null, increment_count_t) : m_p(x) { Py_XINCREF(object()); } - + template reference(T2* x, increment_count_t, allow_null) : m_p(x) { Py_XINCREF(object()); } - + #if !defined(BOOST_MSVC6_OR_EARLIER) - template - reference& operator=(const reference& rhs) - { - Py_XDECREF(object()); - m_p = rhs.m_p; - Py_XINCREF(object()); - return *this; - } + template + reference& operator=(const reference& rhs) + { + Py_XDECREF(object()); + m_p = rhs.m_p; + Py_XINCREF(object()); + return *this; + } #endif - reference& operator=(const reference& rhs) - { - Py_XINCREF(static_cast(rhs.m_p)); - Py_XDECREF(object()); - m_p = rhs.m_p; - return *this; - } + reference& operator=(const reference& rhs) + { + Py_XINCREF(static_cast(rhs.m_p)); + Py_XDECREF(object()); + m_p = rhs.m_p; + return *this; + } - ~reference() - { - Py_XDECREF(m_p); - } - - T& operator*() const { return *m_p; } + ~reference() + { + Py_XDECREF(m_p); + } + + T& operator*() const { return *m_p; } // MSVC doesn't like boost::dereferencable unless T has a default // constructor, so operator-> must be defined by hand :( T* operator->() const { return &**this; } - T* get() const { return m_p; } + T* get() const { return m_p; } - T* release() - { - T* p = m_p; - m_p = 0; - return p; - } + T* release() + { + T* p = m_p; + m_p = 0; + return p; + } void reset() { Py_XDECREF(m_p); m_p = 0; } @@ -139,7 +139,7 @@ public: template void reset(T2* x, increment_count_t) { Py_XDECREF(m_p); m_p = expect_non_null(x); Py_INCREF(object()); } - + template void reset(T2* x, allow_null) { Py_XDECREF(m_p); m_p = x;} @@ -147,11 +147,11 @@ public: template void reset(T2* x, allow_null, increment_count_t) { Py_XDECREF(m_p); m_p = x; Py_XINCREF(object()); } - + template void reset(T2* x, increment_count_t, allow_null) { Py_XDECREF(m_p); m_p = x; Py_XINCREF(object()); } - + #if !defined(BOOST_NO_MEMBER_TEMPLATE_FRIENDS) private: template friend class shared_ptr; @@ -160,7 +160,7 @@ private: inline PyObject* object() const { return as_object(m_p); } - T* m_p; + T* m_p; }; typedef reference ref; diff --git a/test/comprehensive.cpp b/test/comprehensive.cpp index 427ed2d8..3571183e 100644 --- a/test/comprehensive.cpp +++ b/test/comprehensive.cpp @@ -157,7 +157,7 @@ int IntPairPythonClass::getattr(const IntPair& p, const std::string& s) PyErr_SetString(PyExc_AttributeError, s.c_str()); throw boost::python::error_already_set(); } -#if defined(__MWERKS__) && __MWERKS__ <= 0x2400 +#if defined(__MWERKS__) && __MWERKS__ <= 0x2405 return 0; #endif }