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.
diff --git a/Modules/main.c b/Modules/main.c
index ee4a1b8..df4c6d8 100644
--- a/Modules/main.c
+++ b/Modules/main.c
@@ -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();
}
}
}