Mercurial > cpython-lru_cache-weakref
diff Python/pythonrun.c @ 7847:3c4f736d5e01 legacy-trunk
Make sure that the message "Error in sys.exitfunc:" goes to sys.stderr
and not to C's stderr.
| author | Guido van Rossum <guido@python.org> |
|---|---|
| date | Fri, 03 Apr 1998 21:12:12 +0000 |
| parents | b5d52c415b15 |
| children | bbd2b5d8d0b6 |
line wrap: on
line diff
--- a/Python/pythonrun.c Fri Apr 03 21:11:15 1998 +0000 +++ b/Python/pythonrun.c Fri Apr 03 21:12:12 1998 +0000 @@ -1052,12 +1052,14 @@ 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);
