summaryrefslogtreecommitdiffstats
path: root/Python/pythonrun.c
diff options
context:
space:
mode:
Diffstat (limited to 'Python/pythonrun.c')
-rw-r--r--Python/pythonrun.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/Python/pythonrun.c b/Python/pythonrun.c
index 031d66f..ec2c6ca 100644
--- a/Python/pythonrun.c
+++ b/Python/pythonrun.c
@@ -1353,7 +1353,11 @@ handle_system_exit(void)
if (PyLong_Check(value))
exitcode = (int)PyLong_AsLong(value);
else {
+ PyObject *sys_stderr = PySys_GetObject("stderr");
+ if (sys_stderr != NULL)
+ PyObject_CallMethod(sys_stderr, "flush", NULL);
PyObject_Print(value, stderr, Py_PRINT_RAW);
+ fflush(stderr);
PySys_WriteStderr("\n");
exitcode = 1;
}