summaryrefslogtreecommitdiffstats
path: root/Python/pythonrun.c
diff options
context:
space:
mode:
authorVictor Stinner <victor.stinner@haypocalc.com>2010-10-23 08:50:36 (GMT)
committerVictor Stinner <victor.stinner@haypocalc.com>2010-10-23 08:50:36 (GMT)
commit3aa6cea86141efd02a015dd510823837d456ebc3 (patch)
treeb624f962b5e5b95045ff0796257ccfc9f9443f6e /Python/pythonrun.c
parentecdd08462af25573af316e63fdbb1b5e7c6c524a (diff)
downloadcpython-3aa6cea86141efd02a015dd510823837d456ebc3.zip
cpython-3aa6cea86141efd02a015dd510823837d456ebc3.tar.gz
cpython-3aa6cea86141efd02a015dd510823837d456ebc3.tar.bz2
Issue #10077: Fix logging of site module errors at startup.
Diffstat (limited to 'Python/pythonrun.c')
-rw-r--r--Python/pythonrun.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/Python/pythonrun.c b/Python/pythonrun.c
index d08d0ed..98cad37 100644
--- a/Python/pythonrun.c
+++ b/Python/pythonrun.c
@@ -721,14 +721,17 @@ initsite(void)
if (f == NULL || f == Py_None)
return;
if (Py_VerboseFlag) {
+ PyObject *type, *value, *traceback;
+ PyErr_Fetch(&type, &value, &traceback);
PyFile_WriteString(
"'import site' failed; traceback:\n", f);
+ PyErr_Restore(type, value, traceback);
PyErr_Print();
}
else {
+ PyErr_Clear();
PyFile_WriteString(
"'import site' failed; use -v for traceback\n", f);
- PyErr_Clear();
}
}
else {