Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit b5f9460

Browse files
committed
allow safe_import to be called with up to 4 args and check for . in name
1 parent f16d5fa commit b5f9460

1 file changed

Lines changed: 3 additions & 1 deletion

File tree

Lib/rexec.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,9 @@ def new_module(name):
5959
safe_types = new_module('types')
6060
copymodule(types, safe_types)
6161

62-
def safe_import(name):
62+
def safe_import(name, globals=None, locals=None, fromlist=None):
63+
if '.' in name:
64+
raise ImportError, "import of dotted names not supported"
6365
if safe_sys.modules.has_key(name):
6466
return safe_sys.modules[name]
6567
if name in safe_modules:

0 commit comments

Comments
 (0)