python::detail::initialize_wrapper(self, &this->m_held); } # undef N // --------------- value_holder_back_reference --------------- #elif BOOST_PP_ITERATION_DEPTH() == 1 && BOOST_PP_ITERATION_FLAGS() == 2 # if !(BOOST_WORKAROUND(__MWERKS__, > 0x3100) \ && BOOST_WORKAROUND(__MWERKS__, BOOST_TESTED_AT(0x3201))) # line BOOST_PP_LINE(__LINE__, value_holder.hpp(value_holder_back_reference)) # endif # define N BOOST_PP_ITERATION() # if (N != 0) template <BOOST_PP_ENUM_PARAMS_Z(1, N, class A)> # endif value_holder_back_reference( PyObject* p BOOST_PP_COMMA_IF(N) BOOST_PP_ENUM_BINARY_PARAMS_Z(1, N, A, a)) : m_held( p BOOST_PP_COMMA_IF(N) BOOST_PP_REPEAT_1ST(N, BOOST_PYTHON_UNFORWARD_LOCAL, nil) ) { } # undef N #endif
template < class R BOOST_PP_ENUM_TRAILING_PARAMS_Z(1, N, class A) > typename detail::returnable<R>::type call_method(PyObject* self, char const* name BOOST_PP_COMMA_IF(N) BOOST_PP_ENUM_BINARY_PARAMS_Z(1, N, A, const& a) , geofeatures_boost::type<R>* = 0 ) { PyObject* const result = PyEval_CallMethod( self , const_cast<char*>(name) , const_cast<char*>("(" BOOST_PP_REPEAT_1ST(N, BOOST_PYTHON_FIXED, "O") ")") BOOST_PP_REPEAT_1ST(N, BOOST_PYTHON_FAST_ARG_TO_PYTHON_GET, nil) ); // This conversion *must not* be done in the same expression as // the call, because, in the special case where the result is a // reference a Python object which was created by converting a C++ // argument for passing to PyEval_CallFunction, its reference // count will be 2 until the end of the full expression containing // the conversion, and that interferes with dangling // pointer/reference detection. converter::return_from_python<R> converter; return converter(result); } # undef N