diff --git a/include/boost/python/to_python_value.hpp b/include/boost/python/to_python_value.hpp index 3944b2ff..c40299ba 100644 --- a/include/boost/python/to_python_value.hpp +++ b/include/boost/python/to_python_value.hpp @@ -106,7 +106,7 @@ struct object_manager_get_pytype PyObject* operator()(argument_type) const; #ifndef BOOST_PYTHON_NO_PY_SIGNATURES - PyTypeObject const* get_pytype() const {return get_pytype((boost::type*)0);} + PyTypeObject const* get_pytype() const {return get_pytype((boost::type*)0);} #endif // This information helps make_getter() decide whether to try to // return an internal reference or not. I don't like it much, @@ -114,6 +114,8 @@ struct object_manager_get_pytype BOOST_STATIC_CONSTANT(bool, uses_registry = false); private: #ifndef BOOST_PYTHON_NO_PY_SIGNATURES + template + PyTypeObject const* get_pytype(boost::type &> *) const {return converter::registered::converters.to_python_target_type();} template PyTypeObject const* get_pytype(boost::type &> *) const {return converter::registered::converters.to_python_target_type();} #endif diff --git a/test/shared_ptr.cpp b/test/shared_ptr.cpp index 8577700c..ee007abd 100644 --- a/test/shared_ptr.cpp +++ b/test/shared_ptr.cpp @@ -43,6 +43,7 @@ struct functions } static shared_ptr get() { return storage; } + static shared_ptr &get1() { return storage; } static int look_store() { @@ -71,6 +72,8 @@ struct functions .staticmethod("identity") .def("null", &null) .staticmethod("null") + .def("get1", &get1, return_internal_reference<>()) + .staticmethod("get1") .def("get", &get) .staticmethod("get") .def("count", &T::count) @@ -154,6 +157,14 @@ shared_ptr factory(int n) // ------ +// from Neal Becker + +struct Test { + boost::shared_ptr x; +}; +// ------ + + BOOST_PYTHON_MODULE(shared_ptr_ext) { class_, boost::noncopyable>("A") @@ -193,6 +204,12 @@ BOOST_PYTHON_MODULE(shared_ptr_ext) .def("value", &Z::value) .def("v", &Z::v, &ZWrap::default_v) ); + +// from Neal Becker + class_ ("Test") + .def_readonly ("x", &Test::x, "x") + ; +// ------ } #include "module_tail.cpp"