From: Steve Dower Date: Thu, 8 Sep 2016 00:27:33 +0000 (-0700) Subject: Issue #28005: Allow ImportErrors in encoding implementation to propagate. X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=ef37dfcd841bc1565a3e40bbcd0f5354aa150965;p=python Issue #28005: Allow ImportErrors in encoding implementation to propagate. --- diff --git a/Lib/encodings/__init__.py b/Lib/encodings/__init__.py index ca07881f34..cf90568605 100644 --- a/Lib/encodings/__init__.py +++ b/Lib/encodings/__init__.py @@ -98,8 +98,9 @@ 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 ImportError: - pass + except ModuleNotFoundError as ex: + if ex.name != 'encodings.' + modname: + raise else: break else: diff --git a/Misc/NEWS b/Misc/NEWS index b36467776f..fb8a0cb548 100644 --- a/Misc/NEWS +++ b/Misc/NEWS @@ -99,6 +99,8 @@ Core and Builtins Library ------- +- Issue #28005: Allow ImportErrors in encoding implementation to propagate. + - Issue #27570: Avoid zero-length memcpy() etc calls with null source pointers in the "ctypes" and "array" modules.