diff options
author | Guido van Rossum <guido@python.org> | 1995-01-10 10:47:05 +0000 |
---|---|---|
committer | Guido van Rossum <guido@python.org> | 1995-01-10 10:47:05 +0000 |
commit | 84eaa8396e3e8fbc08dd8cbcce0518d7b11fb01a (patch) | |
tree | bf3e6689079e15babe8a0c5c712b775da325cb26 | |
parent | add restrictions in restricted mode (diff) | |
download | cpython-84eaa8396e3e8fbc08dd8cbcce0518d7b11fb01a.tar.gz cpython-84eaa8396e3e8fbc08dd8cbcce0518d7b11fb01a.tar.bz2 cpython-84eaa8396e3e8fbc08dd8cbcce0518d7b11fb01a.zip |
fix globals/locals defaults for eval/execfile
-rw-r--r-- | Python/bltinmodule.c | 20 |
1 files changed, 10 insertions, 10 deletions
diff --git a/Python/bltinmodule.c b/Python/bltinmodule.c index 5577f035c06..53720ada474 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) |