File tree Expand file tree Collapse file tree 3 files changed +10
-8
lines changed
Expand file tree Collapse file tree 3 files changed +10
-8
lines changed Original file line number Diff line number Diff line change 77# define BACK_REFERENCE_DWA2002510_HPP
88
99# include < boost/python/handle.hpp>
10+ # include < boost/python/object_core.hpp>
1011
1112namespace boost { namespace python {
1213
@@ -17,10 +18,10 @@ struct back_reference
1718 typedef T type;
1819
1920 back_reference (PyObject*, T);
20- handle<> reference () const ;
21+ object const & source () const ;
2122 T get () const ;
2223 private:
23- handle<> m_reference ;
24+ object m_source ;
2425 T m_value;
2526};
2627
@@ -75,15 +76,15 @@ class is_back_reference
7576//
7677template <class T >
7778back_reference<T>::back_reference(PyObject* p, T x)
78- : m_reference(python::borrowed (p))
79+ : m_source(detail::borrowed_reference (p))
7980 , m_value(x)
8081{
8182}
8283
8384template <class T >
84- handle<> back_reference<T>::reference () const
85+ object const & back_reference<T>::source () const
8586{
86- return m_reference ;
87+ return m_source ;
8788}
8889
8990template <class T >
Original file line number Diff line number Diff line change 1515# include < boost/python/self.hpp>
1616# include < boost/python/other.hpp>
1717# include < boost/lexical_cast.hpp>
18+ # include < boost/python/refcount.hpp>
1819# include < string>
1920# include < complex>
2021
@@ -251,7 +252,7 @@ namespace detail \
251252 execute (back_reference<L&> l, R const & r) \
252253 { \
253254 l.get () op r; \
254- return l. reference ().release (); \
255+ return python::incref (l. source ().ptr ()); \
255256 } \
256257 }; \
257258 static char const * name () { return " __" #id " __" ; } \
Original file line number Diff line number Diff line change @@ -75,9 +75,9 @@ namespace boost { namespace python
7575}}
7676
7777// prove that back_references get initialized with the right PyObject*
78- PyObject* y_identity (back_reference<Y const &> y)
78+ object y_identity (back_reference<Y const &> y)
7979{
80- return y.reference (). release ();
80+ return y.source ();
8181}
8282
8383// prove that back_references contain the right value
You can’t perform that action at this time.
0 commit comments