From: Christian Heimes Date: Wed, 14 Nov 2007 16:21:32 +0000 (+0000) Subject: Fix for bug #1442 pythonstartup addition of minor error checking X-Git-Tag: v3.0a2~189 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=e69a08ea933e69262b08dc18bb3565892de0ad9b;p=python 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. --- diff --git a/Modules/main.c b/Modules/main.c index ee4a1b8ab0..df4c6d887f 100644 --- a/Modules/main.c +++ b/Modules/main.c @@ -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(); } } }