mirror of
https://github.com/python/cpython.git
synced 2024-11-25 19:03:49 +08:00
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:
parent
9a68f8c304
commit
e69a08ea93
@ -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();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user