diff options
Diffstat (limited to 'libshiboken/helper.h')
-rw-r--r-- | libshiboken/helper.h | 28 |
1 files changed, 15 insertions, 13 deletions
diff --git a/libshiboken/helper.h b/libshiboken/helper.h index 3bda34a7b..a3a974b99 100644 --- a/libshiboken/helper.h +++ b/libshiboken/helper.h @@ -38,6 +38,7 @@ #include <Python.h> #include "shibokenmacros.h" #include "conversions.h" +#include "autodecref.h" namespace Shiboken { @@ -45,34 +46,35 @@ namespace Shiboken template<typename A, typename B> inline PyObject* makeTuple(const A& a, const B& b) { - return PyTuple_Pack(2, Converter<A>::toPython(a), Converter<B>::toPython(b)); + return PyTuple_Pack(2, AutoDecRef(Converter<A>::toPython(a)).object(), + AutoDecRef(Converter<B>::toPython(b)).object()); } template<typename A, typename B, typename C> inline PyObject* makeTuple(const A& a, const B& b, const C& c) { - return PyTuple_Pack(3, Converter<A>::toPython(a), - Converter<B>::toPython(b), - Converter<C>::toPython(c)); + return PyTuple_Pack(3, AutoDecRef(Converter<A>::toPython(a)).object(), + AutoDecRef(Converter<B>::toPython(b)).object(), + AutoDecRef(Converter<C>::toPython(c)).object()); } template<typename A, typename B, typename C, typename D> inline PyObject* makeTuple(const A& a, const B& b, const C& c, const D& d) { - return PyTuple_Pack(4, Converter<A>::toPython(a), - Converter<B>::toPython(b), - Converter<C>::toPython(c), - Converter<D>::toPython(d)); + return PyTuple_Pack(4, AutoDecRef(Converter<A>::toPython(a)).object(), + AutoDecRef(Converter<B>::toPython(b)).object(), + AutoDecRef(Converter<C>::toPython(c)).object(), + AutoDecRef(Converter<D>::toPython(d)).object()); } template<typename A, typename B, typename C, typename D, typename E> inline PyObject* makeTuple(const A& a, const B& b, const C& c, const D& d, const E& e) { - return PyTuple_Pack(5, Converter<A>::toPython(a), - Converter<B>::toPython(b), - Converter<C>::toPython(c), - Converter<D>::toPython(d), - Converter<E>::toPython(e)); + return PyTuple_Pack(5, AutoDecRef(Converter<A>::toPython(a)).object(), + AutoDecRef(Converter<B>::toPython(b)).object(), + AutoDecRef(Converter<C>::toPython(c)).object(), + AutoDecRef(Converter<D>::toPython(d)).object(), + AutoDecRef(Converter<E>::toPython(e)).object()); } /** |