Kaydet (Commit) ecccc4f9 authored tarafından Victor Stinner's avatar Victor Stinner

sys_pyfile_write() does nothing if file is NULL

mywrite() falls back to the C file object if sys_pyfile_write() returns an
error. This patch fixes a segfault is Py_FatalError() is called in an early
stage of Python initialization.
üst 64912485
......@@ -1839,6 +1839,9 @@ sys_pyfile_write(const char *text, PyObject *file)
PyObject *unicode = NULL, *writer = NULL, *args = NULL, *result = NULL;
int err;
if (file == NULL)
return -1;
unicode = PyUnicode_FromString(text);
if (unicode == NULL)
goto error;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment