diff --git a/src/pyobject_converter.h b/src/pyobject_converter.h index c007149..b0453b2 100644 --- a/src/pyobject_converter.h +++ b/src/pyobject_converter.h @@ -32,6 +32,7 @@ class PyObjectListBuilder : public ListBuilder { virtual void append(PyObject *o) { PyList_Append(list, o); + Py_DECREF(o); } virtual PyObject * value() { diff --git a/src/qpython.cpp b/src/qpython.cpp index 92b1b15..c0e59e3 100644 --- a/src/qpython.cpp +++ b/src/qpython.cpp @@ -161,6 +161,7 @@ QPython::importModule_sync(QString name) } PyDict_SetItemString(priv->globals, moduleName, module); + Py_CLEAR(module); priv->leave(); return true; }