[Python-checkins] r85802 - in python/branches/release31-maint: Misc/NEWS Python/pythonrun.c

victor.stinner python-checkins at python.org
Sat Oct 23 10:50:36 CEST 2010


Author: victor.stinner
Date: Sat Oct 23 10:50:36 2010
New Revision: 85802

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


Modified:
   python/branches/release31-maint/Misc/NEWS
   python/branches/release31-maint/Python/pythonrun.c

Modified: python/branches/release31-maint/Misc/NEWS
==============================================================================
--- python/branches/release31-maint/Misc/NEWS	(original)
+++ python/branches/release31-maint/Misc/NEWS	Sat Oct 23 10:50:36 2010
@@ -10,6 +10,8 @@
 Core and Builtins
 -----------------
 
+- Issue #10077: Fix logging of site module errors at startup.
+
 - Issue #9713, #10114: Parser functions (eg. PyParser_ASTFromFile) expects
   filenames encoded to the filesystem encoding with surrogateescape error
   handler (to support undecodable bytes), instead of UTF-8 in strict mode.

Modified: python/branches/release31-maint/Python/pythonrun.c
==============================================================================
--- python/branches/release31-maint/Python/pythonrun.c	(original)
+++ python/branches/release31-maint/Python/pythonrun.c	Sat Oct 23 10:50:36 2010
@@ -721,14 +721,17 @@
         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 {


More information about the Python-checkins mailing list