From ae9f39490647ee8d726d75d6b7c9e73bbd220d37 Mon Sep 17 00:00:00 2001 From: Dave Abrahams Date: Sun, 1 Dec 2002 16:07:54 +0000 Subject: [PATCH] Added reset() [SVN r16465] --- include/boost/python/handle.hpp | 8 ++++++++ 1 file changed, 8 insertions(+) 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