Commit 3821e2d2 authored by Brett Cannon's avatar Brett Cannon

Make the __import__ call in encodings.__init__ absolute with a level 0 call.

parent 22d079b1
...@@ -93,10 +93,10 @@ def search_function(encoding): ...@@ -93,10 +93,10 @@ def search_function(encoding):
if not modname or '.' in modname: if not modname or '.' in modname:
continue continue
try: try:
# Import equivalent to `` from .modname import *``. # Import is absolute to prevent the possibly malicious import of a
# '*' is used so that __import__ returns the desired module and not # module with side-effects that is not in the 'encodings' package.
# 'encodings' itself. mod = __import__('encodings.' + modname, fromlist=_import_tail,
mod = __import__(modname, globals(), locals(), ['*'], 1) level=0)
except ImportError: except ImportError:
pass pass
else: else:
......
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