Chris@16: // Copyright David Abrahams 2002. Chris@16: // Distributed under the Boost Software License, Version 1.0. (See Chris@16: // accompanying file LICENSE_1_0.txt or copy at Chris@16: // http://www.boost.org/LICENSE_1_0.txt) Chris@16: #ifndef DECREF_GUARD_DWA20021220_HPP Chris@16: # define DECREF_GUARD_DWA20021220_HPP Chris@16: Chris@16: namespace boost { namespace python { namespace detail { Chris@16: Chris@16: struct decref_guard Chris@16: { Chris@16: decref_guard(PyObject* o) : obj(o) {} Chris@16: ~decref_guard() { Py_XDECREF(obj); } Chris@16: void cancel() { obj = 0; } Chris@16: private: Chris@16: PyObject* obj; Chris@16: }; Chris@16: Chris@16: }}} // namespace boost::python::detail Chris@16: Chris@16: #endif // DECREF_GUARD_DWA20021220_HPP