diff --git a/include/boost/python/converter/implicit.hpp b/include/boost/python/converter/implicit.hpp index 190bab32..cf5d8fa6 100644 --- a/include/boost/python/converter/implicit.hpp +++ b/include/boost/python/converter/implicit.hpp @@ -29,8 +29,12 @@ struct implicit static void construct(PyObject* obj, rvalue_from_python_stage1_data* data) { void* storage = ((rvalue_from_python_storage*)data)->storage.bytes; + + arg_from_python get_source(obj); + bool convertible = get_source.convertible(); + BOOST_ASSERT(convertible); - new (storage) Target(extract(obj)()); + new (storage) Target(get_source()); // record successful construction data->convertible = storage; diff --git a/include/boost/python/operators.hpp b/include/boost/python/operators.hpp index d10a0094..3851b494 100644 --- a/include/boost/python/operators.hpp +++ b/include/boost/python/operators.hpp @@ -169,7 +169,9 @@ namespace detail \ template \ struct apply \ { \ - static inline PyObject* execute(L& l, R const& r) \ + typedef typename unwrap_wrapper_::type lhs; \ + typedef typename unwrap_wrapper_::type rhs; \ + static PyObject* execute(lhs& l, rhs const& r) \ { \ return detail::convert_result(expr); \ } \ @@ -183,7 +185,9 @@ namespace detail \ template \ struct apply \ { \ - static inline PyObject* execute(R& r, L const& l) \ + typedef typename unwrap_wrapper_::type lhs; \ + typedef typename unwrap_wrapper_::type rhs; \ + static PyObject* execute(rhs& r, lhs const& l) \ { \ return detail::convert_result(expr); \ } \ @@ -271,8 +275,10 @@ namespace detail \ template \ struct apply \ { \ - static inline PyObject* \ - execute(back_reference l, R const& r) \ + typedef typename unwrap_wrapper_::type lhs; \ + typedef typename unwrap_wrapper_::type rhs; \ + static PyObject* \ + execute(back_reference l, rhs const& r) \ { \ l.get() op r; \ return python::incref(l.source().ptr()); \ @@ -311,7 +317,8 @@ namespace detail \ template \ struct apply \ { \ - static PyObject* execute(T& x) \ + typedef typename unwrap_wrapper_::type self_t; \ + static PyObject* execute(self_t& x) \ { \ return detail::convert_result(op(x)); \ } \ @@ -339,6 +346,7 @@ BOOST_PYTHON_UNARY_OPERATOR(long, PyLong_FromLong, long_) BOOST_PYTHON_UNARY_OPERATOR(float, double, float_) BOOST_PYTHON_UNARY_OPERATOR(complex, std::complex, complex_) BOOST_PYTHON_UNARY_OPERATOR(str, lexical_cast, str) +BOOST_PYTHON_UNARY_OPERATOR(repr, lexical_cast, repr) # undef BOOST_PYTHON_UNARY_OPERATOR }} // namespace boost::python @@ -350,6 +358,7 @@ using boost::python::self_ns::long_; using boost::python::self_ns::float_; using boost::python::self_ns::complex_; using boost::python::self_ns::str; +using boost::python::self_ns::repr; using boost::python::self_ns::pow; # endif