diff options
Diffstat (limited to 'Lib/encodings/__init__.py')
-rw-r--r-- | Lib/encodings/__init__.py | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/Lib/encodings/__init__.py b/Lib/encodings/__init__.py index f1e7ecc..383f3b0 100644 --- a/Lib/encodings/__init__.py +++ b/Lib/encodings/__init__.py @@ -93,8 +93,10 @@ def search_function(encoding): if not modname or '.' in modname: continue try: - mod = __import__('encodings.' + modname, - globals(), locals(), _import_tail) + # Import is absolute to prevent the possibly malicious import of a + # module with side-effects that is not in the 'encodings' package. + mod = __import__('encodings.' + modname, fromlist=_import_tail, + level=0) except ImportError: pass else: |