]> granicus.if.org Git - python/commitdiff
Make sure that the message "Error in sys.exitfunc:" goes to sys.stderr
authorGuido van Rossum <guido@python.org>
Fri, 3 Apr 1998 21:12:12 +0000 (21:12 +0000)
committerGuido van Rossum <guido@python.org>
Fri, 3 Apr 1998 21:12:12 +0000 (21:12 +0000)
and not to C's stderr.

Python/pythonrun.c

index 83a0bc14725af2f1a4497f191a4b8835bb11ddd0..87b691aed1a8b9f5adb3791c97fedf5a3e63e9be 100644 (file)
@@ -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);