summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGeorg Brandl <georg@python.org>2008-03-29 01:50:06 +0000
committerGeorg Brandl <georg@python.org>2008-03-29 01:50:06 +0000
commit5087f98a9878dca28b684cbd6f1a6ef01b83d72e (patch)
tree696989735a36b342431dc0834f4a08e7f4786571
parent656bc69036b83029401b6bf807876d49b31f114f (diff)
downloadcpython-5087f98a9878dca28b684cbd6f1a6ef01b83d72e.tar.gz
Backport #1442: report exception when startup file cannot be run.
-rw-r--r--Misc/NEWS3
-rw-r--r--Modules/main.c9
2 files changed, 12 insertions, 0 deletions
diff --git a/Misc/NEWS b/Misc/NEWS
index 893b8ac5c0..7895e7531d 100644
--- a/Misc/NEWS
+++ b/Misc/NEWS
@@ -12,6 +12,9 @@ What's New in Python 2.6 alpha 2?
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.
diff --git a/Modules/main.c b/Modules/main.c
index 21cb48703d..a919740125 100644
--- a/Modules/main.c
+++ b/Modules/main.c
@@ -140,6 +140,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();
}
}
}