File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -106,14 +106,16 @@ struct object_manager_get_pytype<true>
106106
107107 PyObject* operator ()(argument_type) const ;
108108#ifndef BOOST_PYTHON_NO_PY_SIGNATURES
109- PyTypeObject const * get_pytype () const {return get_pytype ((boost::type<T >*)0 );}
109+ PyTypeObject const * get_pytype () const {return get_pytype ((boost::type<argument_type >*)0 );}
110110#endif
111111 // This information helps make_getter() decide whether to try to
112112 // return an internal reference or not. I don't like it much,
113113 // but it will have to serve for now.
114114 BOOST_STATIC_CONSTANT (bool , uses_registry = false );
115115 private:
116116#ifndef BOOST_PYTHON_NO_PY_SIGNATURES
117+ template <class U >
118+ PyTypeObject const * get_pytype (boost::type<shared_ptr<U> &> *) const {return converter::registered<U>::converters.to_python_target_type ();}
117119 template <class U >
118120 PyTypeObject const * get_pytype (boost::type<const shared_ptr<U> &> *) const {return converter::registered<U>::converters.to_python_target_type ();}
119121#endif
Original file line number Diff line number Diff line change @@ -43,6 +43,7 @@ struct functions
4343 }
4444
4545 static shared_ptr<T> get () { return storage; }
46+ static shared_ptr<T> &get1 () { return storage; }
4647
4748 static int look_store ()
4849 {
@@ -71,6 +72,8 @@ struct functions
7172 .staticmethod (" identity" )
7273 .def (" null" , &null)
7374 .staticmethod (" null" )
75+ .def (" get1" , &get1, return_internal_reference<>())
76+ .staticmethod (" get1" )
7477 .def (" get" , &get)
7578 .staticmethod (" get" )
7679 .def (" count" , &T::count)
@@ -154,6 +157,14 @@ shared_ptr<Y> factory(int n)
154157
155158// ------
156159
160+ // from Neal Becker
161+
162+ struct Test {
163+ boost::shared_ptr<X> x;
164+ };
165+ // ------
166+
167+
157168BOOST_PYTHON_MODULE (shared_ptr_ext)
158169{
159170 class_<A, boost::shared_ptr<A_Wrapper>, boost::noncopyable>(" A" )
@@ -193,6 +204,12 @@ BOOST_PYTHON_MODULE(shared_ptr_ext)
193204 .def (" value" , &Z::value)
194205 .def (" v" , &Z::v, &ZWrap::default_v)
195206 );
207+
208+ // from Neal Becker
209+ class_<Test> (" Test" )
210+ .def_readonly (" x" , &Test::x, " x" )
211+ ;
212+ // ------
196213}
197214
198215#include " module_tail.cpp"
You can’t perform that action at this time.
0 commit comments