From: Guido van Rossum Date: Tue, 10 Jan 1995 10:47:05 +0000 (+0000) Subject: fix globals/locals defaults for eval/execfile X-Git-Tag: v1.2b1~36 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=84eaa8396e3e8fbc08dd8cbcce0518d7b11fb01a;p=thirdparty%2FPython%2Fcpython.git fix globals/locals defaults for eval/execfile --- diff --git a/Python/bltinmodule.c b/Python/bltinmodule.c index 5577f035c060..53720ada474c 100644 --- a/Python/bltinmodule.c +++ b/Python/bltinmodule.c @@ -384,7 +384,7 @@ builtin_eval(self, args) object *args; { object *cmd; - object *globals = NULL, *locals = NULL; + object *globals = None, *locals = None; char *str; if (!newgetargs(args, "O|O!O!:eval", @@ -392,12 +392,12 @@ builtin_eval(self, args) &Mappingtype, &globals, &Mappingtype, &locals)) return NULL; - if (globals == NULL) { + if (globals == None) { globals = getglobals(); - if (globals == NULL) - return NULL; + if (locals == None) + locals = getlocals(); } - if (locals == NULL) + else if (locals == None) locals = globals; if (dictlookup(globals, "__builtins__") == NULL) { if (dictinsert(globals, "__builtins__", getbuiltins()) != 0) @@ -428,7 +428,7 @@ builtin_execfile(self, args) object *args; { char *filename; - object *globals = NULL, *locals = NULL; + object *globals = None, *locals = None; object *res; FILE* fp; char *s; @@ -439,12 +439,12 @@ builtin_execfile(self, args) &Mappingtype, &globals, &Mappingtype, &locals)) return NULL; - if (globals == NULL) { + if (globals == None) { globals = getglobals(); - if (globals == NULL) - return NULL; + if (locals == None) + locals = getlocals(); } - if (locals == NULL) + else if (locals == None) locals = globals; if (dictlookup(globals, "__builtins__") == NULL) { if (dictinsert(globals, "__builtins__", getbuiltins()) != 0)