summaryrefslogtreecommitdiffstats
path: root/Lib/encodings
diff options
context:
space:
mode:
authorBrett Cannon <bcannon@gmail.com>2007-02-16 19:33:01 (GMT)
committerBrett Cannon <bcannon@gmail.com>2007-02-16 19:33:01 (GMT)
commitfa6521b4fd72a6b2e959549792c390f6d77e72fe (patch)
tree618d1fe8e8f3792a162d6acd044c49bf0180f208 /Lib/encodings
parent971a012ce178d1b50b272bc035bfcc795e73c781 (diff)
downloadcpython-fa6521b4fd72a6b2e959549792c390f6d77e72fe.zip
cpython-fa6521b4fd72a6b2e959549792c390f6d77e72fe.tar.gz
cpython-fa6521b4fd72a6b2e959549792c390f6d77e72fe.tar.bz2
Make the __import__ call in encodings.__init__ absolute with a level 0 call.
Diffstat (limited to 'Lib/encodings')
-rw-r--r--Lib/encodings/__init__.py8
1 files changed, 4 insertions, 4 deletions
diff --git a/Lib/encodings/__init__.py b/Lib/encodings/__init__.py
index 190b3c4..7db44cb 100644
--- a/Lib/encodings/__init__.py
+++ b/Lib/encodings/__init__.py
@@ -93,10 +93,10 @@ def search_function(encoding):
if not modname or '.' in modname:
continue
try:
- # Import equivalent to `` from .modname import *``.
- # '*' is used so that __import__ returns the desired module and not
- # 'encodings' itself.
- mod = __import__(modname, globals(), locals(), ['*'], 1)
+ # 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: