Use mappinglookup instead of dictlookup for looking up __builtin__.
This commit is contained in:
parent
f9adf48750
commit
5b7f3cd3e1
|
@ -138,8 +138,14 @@ newframeobject(back, code, globals, locals, owner, nvalues, nblocks)
|
||||||
int nvalues;
|
int nvalues;
|
||||||
int nblocks;
|
int nblocks;
|
||||||
{
|
{
|
||||||
|
static object *builtin_object;
|
||||||
frameobject *f;
|
frameobject *f;
|
||||||
object *builtins;
|
object *builtins;
|
||||||
|
if (builtin_object == NULL) {
|
||||||
|
builtin_object = newstringobject("__builtins__");
|
||||||
|
if (builtin_object == NULL)
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
if ((back != NULL && !is_frameobject(back)) ||
|
if ((back != NULL && !is_frameobject(back)) ||
|
||||||
code == NULL || !is_codeobject(code) ||
|
code == NULL || !is_codeobject(code) ||
|
||||||
globals == NULL || !is_dictobject(globals) ||
|
globals == NULL || !is_dictobject(globals) ||
|
||||||
|
@ -148,7 +154,7 @@ newframeobject(back, code, globals, locals, owner, nvalues, nblocks)
|
||||||
err_badcall();
|
err_badcall();
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
builtins = dictlookup(globals, "__builtins__");
|
builtins = mappinglookup(globals, builtin_object);
|
||||||
if (builtins != NULL && is_moduleobject(builtins))
|
if (builtins != NULL && is_moduleobject(builtins))
|
||||||
builtins = getmoduledict(builtins);
|
builtins = getmoduledict(builtins);
|
||||||
if (builtins == NULL || !is_mappingobject(builtins)) {
|
if (builtins == NULL || !is_mappingobject(builtins)) {
|
||||||
|
|
Loading…
Reference in New Issue