summaryrefslogtreecommitdiff
path: root/Python/sysmodule.c
diff options
context:
space:
mode:
Diffstat (limited to 'Python/sysmodule.c')
-rw-r--r--Python/sysmodule.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/Python/sysmodule.c b/Python/sysmodule.c
index b77d18417a..2fcba5471c 100644
--- a/Python/sysmodule.c
+++ b/Python/sysmodule.c
@@ -89,7 +89,7 @@ sys_displayhook(PyObject *self, PyObject *o)
if (PyObject_SetAttrString(builtins, "_", Py_None) != 0)
return NULL;
outf = PySys_GetObject("stdout");
- if (outf == NULL) {
+ if (outf == NULL || outf == Py_None) {
PyErr_SetString(PyExc_RuntimeError, "lost sys.stdout");
return NULL;
}