summaryrefslogtreecommitdiffstats
path: root/Modules
diff options
context:
space:
mode:
authorMartin v. Löwis <martin@v.loewis.de>2003-11-18 19:46:25 (GMT)
committerMartin v. Löwis <martin@v.loewis.de>2003-11-18 19:46:25 (GMT)
commit6caea370ac3e79e8295e456b566a04817eefb0fd (patch)
tree79e835bd5a8e06b160e31ab42f8a02d04b2733f5 /Modules
parentb61982bacbe0ebbeeb7a47018328979302d6221a (diff)
downloadcpython-6caea370ac3e79e8295e456b566a04817eefb0fd.zip
cpython-6caea370ac3e79e8295e456b566a04817eefb0fd.tar.gz
cpython-6caea370ac3e79e8295e456b566a04817eefb0fd.tar.bz2
Patch #794400: Let PYTHONSTARTUP influence the compiler flags.
Diffstat (limited to 'Modules')
-rw-r--r--Modules/main.c23
1 files changed, 14 insertions, 9 deletions
diff --git a/Modules/main.c b/Modules/main.c
index 2cb2b64..91818e0 100644
--- a/Modules/main.c
+++ b/Modules/main.c
@@ -117,6 +117,19 @@ usage(int exitcode, char* program)
/*NOTREACHED*/
}
+static void RunStartupFile(PyCompilerFlags *cf)
+{
+ char *startup = Py_GETENV("PYTHONSTARTUP");
+ if (startup != NULL && startup[0] != '\0') {
+ FILE *fp = fopen(startup, "r");
+ if (fp != NULL) {
+ (void) PyRun_SimpleFileExFlags(fp, startup, 0, cf);
+ PyErr_Clear();
+ fclose(fp);
+ }
+ }
+}
+
/* Main program */
@@ -401,15 +414,7 @@ Py_Main(int argc, char **argv)
}
else {
if (filename == NULL && stdin_is_interactive) {
- char *startup = Py_GETENV("PYTHONSTARTUP");
- if (startup != NULL && startup[0] != '\0') {
- FILE *fp = fopen(startup, "r");
- if (fp != NULL) {
- (void) PyRun_SimpleFile(fp, startup);
- PyErr_Clear();
- fclose(fp);
- }
- }
+ RunStartupFile(&cf);
}
/* XXX */
sts = PyRun_AnyFileExFlags(