Serhiy, I am checking and the only temporary Python object (the result of encoding/decoding) that is passed to C library function that I can find is in:
if (!PyArg_ParseTuple(file_action, "OiO&ik"
";A open file_action tuple must have 5 elements",
&tag_obj, &fd, PyUnicode_FSConverter, &path,
&oflag, &mode))
{
goto fail;
}
errno = posix_spawn_file_actions_addopen(file_actionsp,
fd, PyBytes_AS_STRING(path), oflag, (mode_t)mode);
Py_DECREF(path); /* addopen copied it. */
And according to the manpage of posix_spawn_file_actions_addopen: "The string described by path shall be copied by the posix_spawn_file_actions_addopen() function.".
The object created by `PyArg_ParseTuple` (path) is only freed after calling `posix_spawn_file_actions_addopen` and in that function the contents are copied inside
`file_actionsp`. So it should not be a problem.
In case there is still a problem, could you elaborate more about what object is being freed and how is being passed to a C library function? |