From b5f9460556d98363674fb84b944637f5be29d901 Mon Sep 17 00:00:00 2001 From: Guido van Rossum Date: Thu, 2 Mar 1995 15:30:15 +0000 Subject: [PATCH] allow safe_import to be called with up to 4 args and check for . in name --- Lib/rexec.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/Lib/rexec.py b/Lib/rexec.py index cc908a39957..6f24433f341 100644 --- a/Lib/rexec.py +++ b/Lib/rexec.py @@ -59,7 +59,9 @@ copydict(posix.environ, safe_posix.environ) safe_types = new_module('types') copymodule(types, safe_types) -def safe_import(name): +def safe_import(name, globals=None, locals=None, fromlist=None): + if '.' in name: + raise ImportError, "import of dotted names not supported" if safe_sys.modules.has_key(name): return safe_sys.modules[name] if name in safe_modules: