summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGuido van Rossum <guido@python.org>1998-04-03 21:12:12 (GMT)
committerGuido van Rossum <guido@python.org>1998-04-03 21:12:12 (GMT)
commitbf02fb28d9f9c6b28c1bf7be56ce87924f5742dd (patch)
tree034e09b4e4203f1897888edc9bcd7fa509330e98
parent6deac7a1056aeab17b1c7aeda99761cd1b2fd35d (diff)
downloadcpython-bf02fb28d9f9c6b28c1bf7be56ce87924f5742dd.zip
cpython-bf02fb28d9f9c6b28c1bf7be56ce87924f5742dd.tar.gz
cpython-bf02fb28d9f9c6b28c1bf7be56ce87924f5742dd.tar.bz2
Make sure that the message "Error in sys.exitfunc:" goes to sys.stderr
and not to C's stderr.
-rw-r--r--Python/pythonrun.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/Python/pythonrun.c b/Python/pythonrun.c
index 83a0bc1..87b691a 100644
--- a/Python/pythonrun.c
+++ b/Python/pythonrun.c
@@ -1052,12 +1052,14 @@ call_sys_exitfunc()
PyObject *exitfunc = PySys_GetObject("exitfunc");
if (exitfunc) {
- PyObject *res;
+ PyObject *res, *f;
Py_INCREF(exitfunc);
PySys_SetObject("exitfunc", (PyObject *)NULL);
+ f = PySys_GetObject("stderr");
res = PyEval_CallObject(exitfunc, (PyObject *)NULL);
if (res == NULL) {
- fprintf(stderr, "Error in sys.exitfunc:\n");
+ if (f)
+ PyFile_WriteString("Error in sys.exitfunc:\n", f);
PyErr_Print();
}
Py_DECREF(exitfunc);