Commit fef9bbaf authored by Christian Heimes's avatar Christian Heimes

Another #1415 fix for Windows GUI apps

print() mustn't raise an exception when sys.stdout is None.
parent db23308c
......@@ -1193,8 +1193,12 @@ builtin_print(PyObject *self, PyObject *args, PyObject *kwds)
if (!PyArg_ParseTupleAndKeywords(dummy_args, kwds, "|OOO:print",
kwlist, &sep, &end, &file))
return NULL;
if (file == NULL || file == Py_None)
if (file == NULL || file == Py_None) {
file = PySys_GetObject("stdout");
/* sys.stdout may be None when FILE* stdout isn't connected */
if (file == Py_None)
Py_RETURN_NONE;
}
if (sep && sep != Py_None && !PyUnicode_Check(sep)) {
PyErr_Format(PyExc_TypeError,
......
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