diff --git a/include/boost/python/handle.hpp b/include/boost/python/handle.hpp index 7fea1134..98534944 100755 --- a/include/boost/python/handle.hpp +++ b/include/boost/python/handle.hpp @@ -109,6 +109,7 @@ class handle T& operator* () const; T* get() const; T* release(); + void reset(); operator bool_type() const // never throws { @@ -227,6 +228,13 @@ inline T* handle::release() return result; } +template +inline void handle::reset() +{ + python::xdecref(m_p); + m_p = 0; +} + // Because get_managed_object must return a non-null PyObject*, we // return Py_None if the handle is null. template