]> granicus.if.org Git - python/commitdiff
Backport #1442: report exception when startup file cannot be run.
authorGeorg Brandl <georg@python.org>
Sat, 29 Mar 2008 01:50:46 +0000 (01:50 +0000)
committerGeorg Brandl <georg@python.org>
Sat, 29 Mar 2008 01:50:46 +0000 (01:50 +0000)
Misc/NEWS
Modules/main.c

index c914050134ad67c2090fd54d5429d545a8b29340..7e161193a13bae48cbffb91ff6a15e39afa79799 100644 (file)
--- a/Misc/NEWS
+++ b/Misc/NEWS
@@ -12,6 +12,9 @@ What's New in Python 2.5.3?
 Core and builtins
 -----------------
 
+- Patch #1442: properly report exceptions when the PYTHONSTARTUP file
+  cannot be executed.
+
 - The compilation of a class nested in another class used to leak one
   reference on the outer class name.
 
@@ -27,6 +30,7 @@ Core and builtins
 - Issue #2238: Some syntax errors in *args and **kwargs expressions could give
   bogus error messages.
 
+
 Library
 -------
 
@@ -81,8 +85,9 @@ Build
 Windows
 -------
 
+
 What's New in Python 2.5.2?
-=============================
+===========================
 
 *Release date: 21-Feb-2008*
 
index 80c0c04c3102cfe2f521a3a03503254966c25833..1700b4e4ae536d2b6e43c896af82f8d3dd799952 100644 (file)
@@ -134,6 +134,15 @@ static void RunStartupFile(PyCompilerFlags *cf)
                        (void) PyRun_SimpleFileExFlags(fp, startup, 0, cf);
                        PyErr_Clear();
                        fclose(fp);
+               } else {
+                       int save_errno;
+                       save_errno = errno;
+                       PySys_WriteStderr("Could not open PYTHONSTARTUP\n");
+                       errno = save_errno;
+                       PyErr_SetFromErrnoWithFilename(PyExc_IOError,
+                                                      startup);
+                       PyErr_Print();
+                       PyErr_Clear();
                }
        }
 }