Kaydet (Commit) 91e0cdae authored tarafından Georg Brandl's avatar Georg Brandl

Backport #1442: report exception when startup file cannot be run.

üst 2aece57d
...@@ -12,6 +12,9 @@ What's New in Python 2.6 alpha 2? ...@@ -12,6 +12,9 @@ What's New in Python 2.6 alpha 2?
Core and builtins 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 - The compilation of a class nested in another class used to leak one
reference on the outer class name. reference on the outer class name.
......
...@@ -140,6 +140,15 @@ static void RunStartupFile(PyCompilerFlags *cf) ...@@ -140,6 +140,15 @@ static void RunStartupFile(PyCompilerFlags *cf)
(void) PyRun_SimpleFileExFlags(fp, startup, 0, cf); (void) PyRun_SimpleFileExFlags(fp, startup, 0, cf);
PyErr_Clear(); PyErr_Clear();
fclose(fp); 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();
} }
} }
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment