summaryrefslogtreecommitdiff
path: root/Python/pythonrun.c
diff options
context:
space:
mode:
authorVictor Stinner <victor.stinner@haypocalc.com>2010-10-23 08:50:36 +0000
committerVictor Stinner <victor.stinner@haypocalc.com>2010-10-23 08:50:36 +0000
commita96d8dfecb576056fa536d9acb6041cf5e0b89ca (patch)
tree535efa9e2ad6eef193be1b8f1183e0c98723f437 /Python/pythonrun.c
parentb0e065b30f81fb45b81a3e33d284c3b530b57cf8 (diff)
downloadcpython-a96d8dfecb576056fa536d9acb6041cf5e0b89ca.tar.gz
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 d08d0edd13..98cad37799 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 {