mirror of
https://github.com/python/cpython.git
synced 2025-08-04 17:08:35 +00:00
Revert #27959: ImportError within an encoding module should also skip the encoding
This commit is contained in:
parent
722b685dc1
commit
18591e4189
1 changed files with 4 additions and 3 deletions
|
@ -98,9 +98,10 @@ def search_function(encoding):
|
|||
# module with side-effects that is not in the 'encodings' package.
|
||||
mod = __import__('encodings.' + modname, fromlist=_import_tail,
|
||||
level=0)
|
||||
except ModuleNotFoundError as ex:
|
||||
if ex.name != 'encodings.' + modname:
|
||||
raise
|
||||
except ImportError:
|
||||
# ImportError may occur because 'encodings.(modname)' does not exist,
|
||||
# or because it imports a name that does not exist (see mbcs and oem)
|
||||
pass
|
||||
else:
|
||||
break
|
||||
else:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue