mirror of
https://github.com/python/cpython.git
synced 2025-07-24 19:54:21 +00: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
1 changed files with 10 additions and 0 deletions
|
@ -132,6 +132,16 @@ 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();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue