Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 4a1f39a

Browse files
committed
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.
1 parent 6d48c4a commit 4a1f39a

1 file changed

Lines changed: 6 additions & 7 deletions

File tree

Python/pythonrun.c

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,6 @@ int Py_VerboseFlag; /* Needed by import.c */
7777
int Py_InteractiveFlag; /* Needed by Py_FdIsInteractive() below */
7878
int Py_NoSiteFlag; /* Suppress 'import site' */
7979
int Py_UseClassExceptionsFlag = 1; /* Needed by bltinmodule.c */
80-
int Py_UsingLocale = 0; /* needed by compile.c, modified by localemodule */
8180

8281
static int initialized = 0;
8382

@@ -134,8 +133,8 @@ Py_Initialize()
134133
bimod = _PyBuiltin_Init_1();
135134
if (bimod == NULL)
136135
Py_FatalError("Py_Initialize: can't initialize __builtin__");
137-
Py_INCREF(bimod);
138-
interp->builtins = bimod;
136+
interp->builtins = PyModule_GetDict(bimod);
137+
Py_INCREF(interp->builtins);
139138

140139
sysmod = _PySys_Init();
141140
if (sysmod == NULL)
@@ -148,7 +147,7 @@ Py_Initialize()
148147
interp->modules);
149148

150149
/* phase 2 of builtins */
151-
_PyBuiltin_Init_2(PyModule_GetDict(bimod));
150+
_PyBuiltin_Init_2(interp->builtins);
152151
_PyImport_FixupExtension("__builtin__", "__builtin__");
153152

154153
_PyImport_Init();
@@ -199,7 +198,7 @@ Py_Finalize()
199198
/* Destroy all modules */
200199
PyImport_Cleanup();
201200

202-
/* Delete current thread
201+
/* Delete current thread */
203202
PyInterpreterState_Clear(interp);
204203
PyThreadState_Swap(NULL);
205204
PyInterpreterState_Delete(interp);
@@ -287,8 +286,8 @@ Py_NewInterpreter()
287286

288287
bimod = _PyImport_FindExtension("__builtin__", "__builtin__");
289288
if (bimod != NULL) {
290-
Py_INCREF(bimod);
291-
interp->builtins = bimod;
289+
interp->builtins = PyModule_GetDict(bimod);
290+
Py_INCREF(interp->builtins);
292291
}
293292
sysmod = _PyImport_FindExtension("sys", "sys");
294293
if (bimod != NULL && sysmod != NULL) {

0 commit comments

Comments
 (0)