Mercurial > cpython-lru_cache-weakref
comparison 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 |
comparison
equal
deleted
inserted
replaced
| 7846:6c6a48bc5817 | 7847:3c4f736d5e01 |
|---|---|
| 1050 call_sys_exitfunc() | 1050 call_sys_exitfunc() |
| 1051 { | 1051 { |
| 1052 PyObject *exitfunc = PySys_GetObject("exitfunc"); | 1052 PyObject *exitfunc = PySys_GetObject("exitfunc"); |
| 1053 | 1053 |
| 1054 if (exitfunc) { | 1054 if (exitfunc) { |
| 1055 PyObject *res; | 1055 PyObject *res, *f; |
| 1056 Py_INCREF(exitfunc); | 1056 Py_INCREF(exitfunc); |
| 1057 PySys_SetObject("exitfunc", (PyObject *)NULL); | 1057 PySys_SetObject("exitfunc", (PyObject *)NULL); |
| 1058 f = PySys_GetObject("stderr"); | |
| 1058 res = PyEval_CallObject(exitfunc, (PyObject *)NULL); | 1059 res = PyEval_CallObject(exitfunc, (PyObject *)NULL); |
| 1059 if (res == NULL) { | 1060 if (res == NULL) { |
| 1060 fprintf(stderr, "Error in sys.exitfunc:\n"); | 1061 if (f) |
| 1062 PyFile_WriteString("Error in sys.exitfunc:\n", f); | |
| 1061 PyErr_Print(); | 1063 PyErr_Print(); |
| 1062 } | 1064 } |
| 1063 Py_DECREF(exitfunc); | 1065 Py_DECREF(exitfunc); |
| 1064 } | 1066 } |
| 1065 | 1067 |
