[Python-checkins] r62031 - in python/branches/release25-maint: Misc/NEWS Modules/main.c

georg.brandl python-checkins at python.org
Sat Mar 29 02:50:46 CET 2008


Author: georg.brandl
Date: Sat Mar 29 02:50:46 2008
New Revision: 62031

Modified:
   python/branches/release25-maint/Misc/NEWS
   python/branches/release25-maint/Modules/main.c
Log:
Backport #1442: report exception when startup file cannot be run.


Modified: python/branches/release25-maint/Misc/NEWS
==============================================================================
--- python/branches/release25-maint/Misc/NEWS	(original)
+++ python/branches/release25-maint/Misc/NEWS	Sat Mar 29 02:50:46 2008
@@ -12,6 +12,9 @@
 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 @@
 - Issue #2238: Some syntax errors in *args and **kwargs expressions could give
   bogus error messages.
 
+
 Library
 -------
 
@@ -81,8 +85,9 @@
 Windows
 -------
 
+
 What's New in Python 2.5.2?
-=============================
+===========================
 
 *Release date: 21-Feb-2008*
 

Modified: python/branches/release25-maint/Modules/main.c
==============================================================================
--- python/branches/release25-maint/Modules/main.c	(original)
+++ python/branches/release25-maint/Modules/main.c	Sat Mar 29 02:50:46 2008
@@ -134,6 +134,15 @@
 			(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();
 		}
 	}
 }


More information about the Python-checkins mailing list