diff Python/import.c @ 2098:b7be0382f9ee legacy-trunk

__builtins__ mods (and sys_checkinterval for ceval.c)
author Guido van Rossum <guido@python.org>
date Mon, 09 Jan 1995 17:53:26 +0000
parents d0d0a69b5ca3
children 92da8901517e
line wrap: on
line diff
--- a/Python/import.c	Mon Jan 09 17:50:47 1995 +0000
+++ b/Python/import.c	Mon Jan 09 17:53:26 1995 +0000
@@ -32,6 +32,7 @@
 #include "import.h"
 #include "errcode.h"
 #include "sysmodule.h"
+#include "bltinmodule.h"
 #include "pythonrun.h"
 #include "marshal.h"
 #include "compile.h"
@@ -147,6 +148,10 @@
 	if (m == NULL)
 		return NULL;
 	d = getmoduledict(m);
+	if (dictlookup(d, "__builtins__") == NULL) {
+		if (dictinsert(d, "__builtins__", getbuiltindict()) != 0)
+			return NULL;
+	}
 	v = eval_code((codeobject *)co, d, d, d, (object *)NULL);
 	if (v == NULL)
 		return NULL;