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.
This commit is contained in:
Christian Heimes 2007-11-14 16:21:32 +00:00
parent 9a68f8c304
commit e69a08ea93
1 changed files with 10 additions and 0 deletions

View File

@ -132,6 +132,16 @@ 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();
}
}
}