Skip to content

Commit ae9f394

Browse files
committed
Added reset()
[SVN r16465]
1 parent 8467f36 commit ae9f394

1 file changed

Lines changed: 8 additions & 0 deletions

File tree

include/boost/python/handle.hpp

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -109,6 +109,7 @@ class handle
109109
T& operator* () const;
110110
T* get() const;
111111
T* release();
112+
void reset();
112113

113114
operator bool_type() const // never throws
114115
{
@@ -227,6 +228,13 @@ inline T* handle<T>::release()
227228
return result;
228229
}
229230

231+
template <class T>
232+
inline void handle<T>::reset()
233+
{
234+
python::xdecref(m_p);
235+
m_p = 0;
236+
}
237+
230238
// Because get_managed_object must return a non-null PyObject*, we
231239
// return Py_None if the handle is null.
232240
template <class T>

0 commit comments

Comments
 (0)