Commit 1870de2b authored by Vincent Pelletier's avatar Vincent Pelletier

Disallow importing module properties which start with underscore.

parent 96431983
...@@ -197,6 +197,9 @@ del alias, real ...@@ -197,6 +197,9 @@ del alias, real
orig_guarded_import = safe_builtins['__import__'] orig_guarded_import = safe_builtins['__import__']
def guarded_import(mname, globals=None, locals=None, fromlist=None, def guarded_import(mname, globals=None, locals=None, fromlist=None,
level=-1): level=-1):
for fromname in fromlist or ():
if fromname[:1] == '_':
raise Unauthorized(fromname)
if mname in MNAME_MAP: if mname in MNAME_MAP:
mname = MNAME_MAP[mname] mname = MNAME_MAP[mname]
if not fromlist: if not fromlist:
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment