diff options
author | Steve Dower <steve.dower@microsoft.com> | 2016-09-09 08:56:37 -0700 |
---|---|---|
committer | Steve Dower <steve.dower@microsoft.com> | 2016-09-09 08:56:37 -0700 |
commit | 18591e418915aad9811dc1c7a064ca244fcc7f68 (patch) | |
tree | 7d76f31816c8f72856d67a56e8c297d96ab149f1 /Lib/encodings/__init__.py | |
parent | Merge 3.5 (diff) | |
download | cpython-18591e418915aad9811dc1c7a064ca244fcc7f68.tar.gz cpython-18591e418915aad9811dc1c7a064ca244fcc7f68.tar.bz2 cpython-18591e418915aad9811dc1c7a064ca244fcc7f68.zip |
Revert #27959: ImportError within an encoding module should also skip the encoding
Diffstat (limited to 'Lib/encodings/__init__.py')
-rw-r--r-- | Lib/encodings/__init__.py | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/Lib/encodings/__init__.py b/Lib/encodings/__init__.py index cf905686058..aa2fb7c2b93 100644 --- a/Lib/encodings/__init__.py +++ b/Lib/encodings/__init__.py @@ -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: |