[Python-3000-checkins] r58969 - python/branches/py3k/Modules/main.c

christian.heimes python-3000-checkins at python.org
Wed Nov 14 17:21:32 CET 2007


Author: christian.heimes
Date: Wed Nov 14 17:21:32 2007
New Revision: 58969

Modified:
   python/branches/py3k/Modules/main.c
Log:
Fix for bug #1442 pythonstartup addition of minor error checking
Python failed to report an error when it wasn't able to open the PYTHONSTARTUP file.

Modified: python/branches/py3k/Modules/main.c
==============================================================================
--- python/branches/py3k/Modules/main.c	(original)
+++ python/branches/py3k/Modules/main.c	Wed Nov 14 17:21:32 2007
@@ -132,6 +132,16 @@
 			(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-3000-checkins mailing list