mirror of
https://github.com/python/cpython.git
synced 2026-01-06 15:32:22 +00:00
Make the __import__ call in encodings.__init__ absolute with a level 0 call.
This commit is contained in:
parent
971a012ce1
commit
fa6521b4fd
1 changed files with 4 additions and 4 deletions
|
|
@ -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:
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue