mirror of https://github.com/python/cpython
allow safe_import to be called with up to 4 args and check for . in name
This commit is contained in:
parent
f16d5fa46f
commit
b5f9460556
|
@ -59,7 +59,9 @@ copydict(posix.environ, safe_posix.environ)
|
||||||
safe_types = new_module('types')
|
safe_types = new_module('types')
|
||||||
copymodule(types, safe_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):
|
if safe_sys.modules.has_key(name):
|
||||||
return safe_sys.modules[name]
|
return safe_sys.modules[name]
|
||||||
if name in safe_modules:
|
if name in safe_modules:
|
||||||
|
|
Loading…
Reference in New Issue