summaryrefslogtreecommitdiff
path: root/src/pyutils.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/pyutils.h')
-rw-r--r--src/pyutils.h5
1 files changed, 3 insertions, 2 deletions
diff --git a/src/pyutils.h b/src/pyutils.h
index 42d5f1e0..51ca8734 100644
--- a/src/pyutils.h
+++ b/src/pyutils.h
@@ -27,8 +27,9 @@ struct register_optional_to_python : public boost::noncopyable
{
static PyObject * convert(const boost::optional<T>& value)
{
- return (value ? boost::python::to_python_value<T>()(*value) :
- boost::python::detail::none());
+ return boost::python::incref
+ (value ? boost::python::to_python_value<T>()(*value) :
+ boost::python::detail::none());
}
};