Mercurial > cpython-lru_cache-weakref
comparison Python/pythonrun.c @ 6557:b331cd47e0bc legacy-trunk
Undo half of the previous change :-(
Setting interp->builtins to the __builtin__ module instead of to its
dictionary had the unfortunate side effect of always running in
restricted execution mode :-(
I will check in a different way of setting __main__.__builtins__ to
the __builtin__ module later.
Also, there was a typo -- a comment was unfinished, and as a result
some finalizations were not being executed.
In Bart Simpson style,
I Will Not Check In Untested Changes.
I Will Not Check In Untested Changes.
I Will Not Check In Untested Changes.
I Will Not Check In Untested Changes.
I Will Not Check In Untested Changes.
I Will Not Check In Untested Changes.
I Will Not Check In Untested Changes.
I Will Not Check In Untested Changes.
I Will Not Check In Untested Changes.
I Will Not Check In Untested Changes.
| author | Guido van Rossum <guido@python.org> |
|---|---|
| date | Tue, 04 Nov 1997 19:36:18 +0000 |
| parents | 724382af5339 |
| children | 83ccf44bf195 |
comparison
equal
deleted
inserted
replaced
| 6556:4280b2729cce | 6557:b331cd47e0bc |
|---|---|
| 75 int Py_DebugFlag; /* Needed by parser.c */ | 75 int Py_DebugFlag; /* Needed by parser.c */ |
| 76 int Py_VerboseFlag; /* Needed by import.c */ | 76 int Py_VerboseFlag; /* Needed by import.c */ |
| 77 int Py_InteractiveFlag; /* Needed by Py_FdIsInteractive() below */ | 77 int Py_InteractiveFlag; /* Needed by Py_FdIsInteractive() below */ |
| 78 int Py_NoSiteFlag; /* Suppress 'import site' */ | 78 int Py_NoSiteFlag; /* Suppress 'import site' */ |
| 79 int Py_UseClassExceptionsFlag = 1; /* Needed by bltinmodule.c */ | 79 int Py_UseClassExceptionsFlag = 1; /* Needed by bltinmodule.c */ |
| 80 int Py_UsingLocale = 0; /* needed by compile.c, modified by localemodule */ | |
| 81 | 80 |
| 82 static int initialized = 0; | 81 static int initialized = 0; |
| 83 | 82 |
| 84 /* API to access the initialized flag -- useful for eroteric use */ | 83 /* API to access the initialized flag -- useful for eroteric use */ |
| 85 | 84 |
| 132 Py_FatalError("Py_Initialize: can't make modules dictionary"); | 131 Py_FatalError("Py_Initialize: can't make modules dictionary"); |
| 133 | 132 |
| 134 bimod = _PyBuiltin_Init_1(); | 133 bimod = _PyBuiltin_Init_1(); |
| 135 if (bimod == NULL) | 134 if (bimod == NULL) |
| 136 Py_FatalError("Py_Initialize: can't initialize __builtin__"); | 135 Py_FatalError("Py_Initialize: can't initialize __builtin__"); |
| 137 Py_INCREF(bimod); | 136 interp->builtins = PyModule_GetDict(bimod); |
| 138 interp->builtins = bimod; | 137 Py_INCREF(interp->builtins); |
| 139 | 138 |
| 140 sysmod = _PySys_Init(); | 139 sysmod = _PySys_Init(); |
| 141 if (sysmod == NULL) | 140 if (sysmod == NULL) |
| 142 Py_FatalError("Py_Initialize: can't initialize sys"); | 141 Py_FatalError("Py_Initialize: can't initialize sys"); |
| 143 interp->sysdict = PyModule_GetDict(sysmod); | 142 interp->sysdict = PyModule_GetDict(sysmod); |
| 146 PySys_SetPath(Py_GetPath()); | 145 PySys_SetPath(Py_GetPath()); |
| 147 PyDict_SetItemString(interp->sysdict, "modules", | 146 PyDict_SetItemString(interp->sysdict, "modules", |
| 148 interp->modules); | 147 interp->modules); |
| 149 | 148 |
| 150 /* phase 2 of builtins */ | 149 /* phase 2 of builtins */ |
| 151 _PyBuiltin_Init_2(PyModule_GetDict(bimod)); | 150 _PyBuiltin_Init_2(interp->builtins); |
| 152 _PyImport_FixupExtension("__builtin__", "__builtin__"); | 151 _PyImport_FixupExtension("__builtin__", "__builtin__"); |
| 153 | 152 |
| 154 _PyImport_Init(); | 153 _PyImport_Init(); |
| 155 | 154 |
| 156 initsigs(); /* Signal handling stuff, including initintr() */ | 155 initsigs(); /* Signal handling stuff, including initintr() */ |
| 197 _PyBuiltin_Fini_1(); | 196 _PyBuiltin_Fini_1(); |
| 198 | 197 |
| 199 /* Destroy all modules */ | 198 /* Destroy all modules */ |
| 200 PyImport_Cleanup(); | 199 PyImport_Cleanup(); |
| 201 | 200 |
| 202 /* Delete current thread | 201 /* Delete current thread */ |
| 203 PyInterpreterState_Clear(interp); | 202 PyInterpreterState_Clear(interp); |
| 204 PyThreadState_Swap(NULL); | 203 PyThreadState_Swap(NULL); |
| 205 PyInterpreterState_Delete(interp); | 204 PyInterpreterState_Delete(interp); |
| 206 | 205 |
| 207 _PyImport_Fini(); | 206 _PyImport_Fini(); |
| 285 | 284 |
| 286 interp->modules = PyDict_New(); | 285 interp->modules = PyDict_New(); |
| 287 | 286 |
| 288 bimod = _PyImport_FindExtension("__builtin__", "__builtin__"); | 287 bimod = _PyImport_FindExtension("__builtin__", "__builtin__"); |
| 289 if (bimod != NULL) { | 288 if (bimod != NULL) { |
| 290 Py_INCREF(bimod); | 289 interp->builtins = PyModule_GetDict(bimod); |
| 291 interp->builtins = bimod; | 290 Py_INCREF(interp->builtins); |
| 292 } | 291 } |
| 293 sysmod = _PyImport_FindExtension("sys", "sys"); | 292 sysmod = _PyImport_FindExtension("sys", "sys"); |
| 294 if (bimod != NULL && sysmod != NULL) { | 293 if (bimod != NULL && sysmod != NULL) { |
| 295 interp->sysdict = PyModule_GetDict(sysmod); | 294 interp->sysdict = PyModule_GetDict(sysmod); |
| 296 Py_INCREF(interp->sysdict); | 295 Py_INCREF(interp->sysdict); |
