Commit 3aa6cea8 authored by Victor Stinner's avatar Victor Stinner

Issue #10077: Fix logging of site module errors at startup.

parent ecdd0846
...@@ -10,6 +10,8 @@ What's New in Python 3.1.3? ...@@ -10,6 +10,8 @@ What's New in Python 3.1.3?
Core and Builtins Core and Builtins
----------------- -----------------
- Issue #10077: Fix logging of site module errors at startup.
- Issue #9713, #10114: Parser functions (eg. PyParser_ASTFromFile) expects - Issue #9713, #10114: Parser functions (eg. PyParser_ASTFromFile) expects
filenames encoded to the filesystem encoding with surrogateescape error filenames encoded to the filesystem encoding with surrogateescape error
handler (to support undecodable bytes), instead of UTF-8 in strict mode. handler (to support undecodable bytes), instead of UTF-8 in strict mode.
......
...@@ -721,14 +721,17 @@ initsite(void) ...@@ -721,14 +721,17 @@ initsite(void)
if (f == NULL || f == Py_None) if (f == NULL || f == Py_None)
return; return;
if (Py_VerboseFlag) { if (Py_VerboseFlag) {
PyObject *type, *value, *traceback;
PyErr_Fetch(&type, &value, &traceback);
PyFile_WriteString( PyFile_WriteString(
"'import site' failed; traceback:\n", f); "'import site' failed; traceback:\n", f);
PyErr_Restore(type, value, traceback);
PyErr_Print(); PyErr_Print();
} }
else { else {
PyErr_Clear();
PyFile_WriteString( PyFile_WriteString(
"'import site' failed; use -v for traceback\n", f); "'import site' failed; use -v for traceback\n", f);
PyErr_Clear();
} }
} }
else { else {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment