From 93501af04601590e46feede4a11e03fae700d2d6 Mon Sep 17 00:00:00 2001 From: Dave Abrahams Date: Mon, 21 Jan 2002 06:23:33 +0000 Subject: [PATCH] always use ref (counting) for safety [SVN r12393] --- include/boost/python/object/class.hpp | 4 ++-- include/boost/python/object/class_converters.hpp | 5 +++-- include/boost/python/object/class_wrapper.hpp | 2 +- 3 files changed, 6 insertions(+), 5 deletions(-) diff --git a/include/boost/python/object/class.hpp b/include/boost/python/object/class.hpp index 808e3669..4817e15d 100644 --- a/include/boost/python/object/class.hpp +++ b/include/boost/python/object/class.hpp @@ -38,8 +38,8 @@ struct BOOST_PYTHON_DECL class_base : noncopyable // any bases. ); - // Retrieve a pointer to the underlying object - PyObject* object() const { return m_object.get(); } + // Retrieve the underlying object + ref object() const { return m_object; } private: ref m_object; }; diff --git a/include/boost/python/object/class_converters.hpp b/include/boost/python/object/class_converters.hpp index c14103b6..d4ba4b6d 100644 --- a/include/boost/python/object/class_converters.hpp +++ b/include/boost/python/object/class_converters.hpp @@ -9,6 +9,7 @@ # include # include # include +# include namespace boost { namespace python { namespace objects { @@ -20,7 +21,7 @@ struct class_converters { public: // member functions // Constructor takes the python class object associated with T - class_converters(PyObject* python_class); + class_converters(ref const& python_class); private: // data members converter::class_unwrapper m_unwrapper; @@ -86,7 +87,7 @@ struct register_base_of }; template -class_converters::class_converters(PyObject* type_object) +class_converters::class_converters(ref const& type_object) : m_wrapper(type_object) { // register all up/downcasts here diff --git a/include/boost/python/object/class_wrapper.hpp b/include/boost/python/object/class_wrapper.hpp index 0e49ce84..cbfb2ae6 100644 --- a/include/boost/python/object/class_wrapper.hpp +++ b/include/boost/python/object/class_wrapper.hpp @@ -18,7 +18,7 @@ template struct class_wrapper : converter::wrapper { - class_wrapper(PyObject* type_) + class_wrapper(ref const& type_) : m_class_object(type_) { # ifndef NDEBUG