comparison Python/pythonrun.c @ 2098:b7be0382f9ee legacy-trunk

__builtins__ mods (and sys_checkinterval for ceval.c)
author Guido van Rossum <guido@python.org>
date Mon, 09 Jan 1995 17:53:26 +0000
parents d0d0a69b5ca3
children 92da8901517e
comparison
equal deleted inserted replaced
2097:e4588404fdff 2098:b7be0382f9ee
30 #include "node.h" 30 #include "node.h"
31 #include "parsetok.h" 31 #include "parsetok.h"
32 #include "graminit.h" 32 #include "graminit.h"
33 #include "errcode.h" 33 #include "errcode.h"
34 #include "sysmodule.h" 34 #include "sysmodule.h"
35 #include "bltinmodule.h"
35 #include "compile.h" 36 #include "compile.h"
36 #include "eval.h" 37 #include "eval.h"
37 #include "ceval.h" 38 #include "ceval.h"
38 #include "pythonrun.h" 39 #include "pythonrun.h"
39 #include "import.h" 40 #include "import.h"
46 extern char *getpythonpath(); 47 extern char *getpythonpath();
47 48
48 extern grammar gram; /* From graminit.c */ 49 extern grammar gram; /* From graminit.c */
49 50
50 /* Forward */ 51 /* Forward */
52 static void initmain PROTO((void));
51 static object *run_err_node PROTO((node *n, char *filename, 53 static object *run_err_node PROTO((node *n, char *filename,
52 object *globals, object *locals)); 54 object *globals, object *locals));
53 static object *run_node PROTO((node *n, char *filename, 55 static object *run_node PROTO((node *n, char *filename,
54 object *globals, object *locals)); 56 object *globals, object *locals));
55 static void err_input PROTO((perrdetail *)); 57 static void err_input PROTO((perrdetail *));
81 initsys(); 83 initsys();
82 84
83 setpythonpath(getpythonpath()); 85 setpythonpath(getpythonpath());
84 86
85 initsigs(); /* Signal handling stuff, including initintr() */ 87 initsigs(); /* Signal handling stuff, including initintr() */
88
89 initmain();
90 }
91
92 /* Create __main__ module */
93
94 static void
95 initmain()
96 {
97 object *m, *d;
98 m = add_module("__main__");
99 if (m == NULL)
100 fatal("can't create __main__ module");
101 d = getmoduledict(m);
102 if (dictlookup(d, "__builtins__") == NULL) {
103 if (dictinsert(d, "__builtins__", getbuiltindict()))
104 fatal("can't add __builtins__ to __main__");
105 }
86 } 106 }
87 107
88 /* Parse input from a file and execute it */ 108 /* Parse input from a file and execute it */
89 109
90 int 110 int