[Python-checkins] r83858 - python/branches/release27-maint/Python/pythonrun.c
antoine.pitrou
python-checkins at python.org
Sun Aug 8 23:37:51 CEST 2010
Author: antoine.pitrou
Date: Sun Aug 8 23:37:51 2010
New Revision: 83858
Log:
sys.stderr and sys.excepthook can be None at interpreter shutdown,
in which case display the appropriate error message.
(part of #5319)
Modified:
python/branches/release27-maint/Python/pythonrun.c
Modified: python/branches/release27-maint/Python/pythonrun.c
==============================================================================
--- python/branches/release27-maint/Python/pythonrun.c (original)
+++ python/branches/release27-maint/Python/pythonrun.c Sun Aug 8 23:37:51 2010
@@ -1149,7 +1149,7 @@
PySys_SetObject("last_traceback", tb);
}
hook = PySys_GetObject("excepthook");
- if (hook) {
+ if (hook && hook != Py_None) {
PyObject *args = PyTuple_Pack(3,
exception, v, tb ? tb : Py_None);
PyObject *result = PyEval_CallObject(hook, args);
@@ -1199,7 +1199,7 @@
int err = 0;
PyObject *f = PySys_GetObject("stderr");
Py_INCREF(value);
- if (f == NULL)
+ if (f == NULL || f == Py_None)
fprintf(stderr, "lost sys.stderr\n");
else {
if (Py_FlushLine())
More information about the Python-checkins
mailing list