diff options
author | Guido van Rossum <guido@python.org> | 1995-03-02 15:30:15 (GMT) |
---|---|---|
committer | Guido van Rossum <guido@python.org> | 1995-03-02 15:30:15 (GMT) |
commit | b5f9460556d98363674fb84b944637f5be29d901 (patch) | |
tree | 1414f7db946a0efc3e0778666d2a0ee1d5008a74 /Lib | |
parent | f16d5fa46f9b9a18422c506abfb25cffc38706d5 (diff) | |
download | cpython-b5f9460556d98363674fb84b944637f5be29d901.zip cpython-b5f9460556d98363674fb84b944637f5be29d901.tar.gz cpython-b5f9460556d98363674fb84b944637f5be29d901.tar.bz2 |
allow safe_import to be called with up to 4 args and check for . in name
Diffstat (limited to 'Lib')
-rw-r--r-- | Lib/rexec.py | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/Lib/rexec.py b/Lib/rexec.py index cc908a3..6f24433 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: |