diff --git a/pyptr.h b/pyptr.h index f6437f4a..81bd7f55 100644 --- a/pyptr.h +++ b/pyptr.h @@ -28,13 +28,13 @@ template struct PyPtrConversions : Base { inline friend T from_python(PyObject* x, py::Type) - { return T(x, T::new_ref); } + { return T(py::Downcast(x).get(), T::new_ref); } inline friend T from_python(PyObject* x, py::Type) - { return T(x, T::new_ref); } + { return T(py::Downcast(x).get(), T::new_ref); } inline friend PyObject* to_python(T x) - { return x.release(); } + { return as_object(x.release()); } }; @@ -49,6 +49,8 @@ class PyPtr boost::dereferenceable, T*> > // supplies op-> { public: + typedef T value_type; + PyPtr(const PyPtr& rhs) : m_p(rhs.m_p) {