Along the creation of python dict, few lists are created and then
inserted into the dict using PyDict_SetItemString/DictSafeSetItem. The
latter internaly uses PyDict_SetItemString. This function does not steal
a reference to its VAL argument, i.e. it increments the refcount of the
list.
Once this is done, a call to Py_DECREF should be made to indicate that
the c++ code does not own the list anymore. Not doing so caused few
memory leaks.
Along the creation of python dict, few lists are created and then inserted into the dict using PyDict_SetItemString/DictSafeSetItem. The latter internaly uses PyDict_SetItemString. This function does not steal a reference to its VAL argument, i.e. it increments the refcount of the list.
Once this is done, a call to Py_DECREF should be made to indicate that the c++ code does not own the list anymore. Not doing so caused few memory leaks.