Mercurial > cpython-lru_cache-weakref
diff Python/bltinmodule.c @ 43844:2c97e24b16cf
Another #1415 fix for Windows GUI apps
print() mustn't raise an exception when sys.stdout is None.
| author | Christian Heimes <christian@cheimes.de> |
|---|---|
| date | Tue, 13 Nov 2007 15:24:14 +0000 |
| parents | 0d462d789b18 |
| children | ee081609cee8 |
line wrap: on
line diff
--- a/Python/bltinmodule.c Tue Nov 13 02:34:21 2007 +0000 +++ b/Python/bltinmodule.c Tue Nov 13 15:24:14 2007 +0000 @@ -1192,9 +1192,13 @@ } if (!PyArg_ParseTupleAndKeywords(dummy_args, kwds, "|OOO:print", kwlist, &sep, &end, &file)) - return NULL; - if (file == NULL || file == Py_None) + return NULL; + 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,
