File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -12,6 +12,8 @@ What's New in Python 2.4 alpha 1?
1212Core and builtins
1313-----------------
1414
15+ - Compiler flags set in PYTHONSTARTUP are now active in __main__.
16+
1517- Added two builtin types, set() and frozenset().
1618
1719- Critical bugfix, for SF bug 840829: if cyclic garbage collection
Original file line number Diff line number Diff line change @@ -117,6 +117,19 @@ usage(int exitcode, char* program)
117117 /*NOTREACHED*/
118118}
119119
120+ static void RunStartupFile (PyCompilerFlags * cf )
121+ {
122+ char * startup = Py_GETENV ("PYTHONSTARTUP" );
123+ if (startup != NULL && startup [0 ] != '\0' ) {
124+ FILE * fp = fopen (startup , "r" );
125+ if (fp != NULL ) {
126+ (void ) PyRun_SimpleFileExFlags (fp , startup , 0 , cf );
127+ PyErr_Clear ();
128+ fclose (fp );
129+ }
130+ }
131+ }
132+
120133
121134/* Main program */
122135
@@ -401,15 +414,7 @@ Py_Main(int argc, char **argv)
401414 }
402415 else {
403416 if (filename == NULL && stdin_is_interactive ) {
404- char * startup = Py_GETENV ("PYTHONSTARTUP" );
405- if (startup != NULL && startup [0 ] != '\0' ) {
406- FILE * fp = fopen (startup , "r" );
407- if (fp != NULL ) {
408- (void ) PyRun_SimpleFile (fp , startup );
409- PyErr_Clear ();
410- fclose (fp );
411- }
412- }
417+ RunStartupFile (& cf );
413418 }
414419 /* XXX */
415420 sts = PyRun_AnyFileExFlags (
You can’t perform that action at this time.
0 commit comments