Closed zhaohainan666 closed 6 years ago
Thank you.
Looks like this bug related to https://github.com/Falldog/pyconcrete/issues/31
, so if additionally to described there changes I comment this line of code
//Py_DECREF(py_args);
, then I don't need anymore moving free(content) to the middle of the func from the end of code block where it was before.
So looks like this double-free call sometimes destroyed something so next free(..) failed then.
According to the Python documentation, PyTuple_SetItem
steals a reference to the inserted object. So you shouldn't dereference py_content
manually since py_args
now owns py_content
.
I think you should remove the Py_DECREF(py_content);
line instead of the Py_DECREF(py_args);
line.
Ok. Just posted the resulted source code (that works Ok for me at least now both for simple example and for complex project with many-many *.python modules):
@zhaohainan666
excellent, thanks for your help, I didn't notice the PyTuple_SetItem
will steal a reference.
I can't reproduce the issue. I will fix it and please help to check it in the latest code, thanks.
https://github.com/Falldog/pyconcrete/blob/49352b2c3a725e48e53ac27a8f524b9d7af808f1/src/pyconcrete_exe/pyconcrete_exe.c#L142
py_content has been released in Py_DECREF(py_args)