(original) (raw)
changeset: 103400:4e80a157ea66 user: Steve Dower steve.dower@microsoft.com date: Fri Sep 09 08:56:37 2016 -0700 files: Lib/encodings/__init__.py description: Revert #27959: ImportError within an encoding module should also skip the encoding diff -r f8340e2991e9 -r 4e80a157ea66 Lib/encodings/__init__.py --- a/Lib/encodings/__init__.py Fri Sep 09 11:36:59 2016 -0400 +++ b/Lib/encodings/__init__.py Fri Sep 09 08:56:37 2016 -0700 @@ -98,9 +98,10 @@ # 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: /steve.dower@microsoft.com