[Python-checkins] r53801 - python/trunk/Lib/encodings/__init__.py

brett.cannon python-checkins at python.org
Fri Feb 16 20:33:01 CET 2007


Author: brett.cannon
Date: Fri Feb 16 20:33:01 2007
New Revision: 53801

Modified:
   python/trunk/Lib/encodings/__init__.py
Log:
Make the __import__ call in encodings.__init__ absolute with a level 0 call.


Modified: python/trunk/Lib/encodings/__init__.py
==============================================================================
--- python/trunk/Lib/encodings/__init__.py	(original)
+++ python/trunk/Lib/encodings/__init__.py	Fri Feb 16 20:33:01 2007
@@ -93,10 +93,10 @@
         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:


More information about the Python-checkins mailing list