]> granicus.if.org Git - python/commitdiff
Issue #28005: Allow ImportErrors in encoding implementation to propagate.
authorSteve Dower <steve.dower@microsoft.com>
Thu, 8 Sep 2016 00:27:33 +0000 (17:27 -0700)
committerSteve Dower <steve.dower@microsoft.com>
Thu, 8 Sep 2016 00:27:33 +0000 (17:27 -0700)
Lib/encodings/__init__.py
Misc/NEWS

index ca07881f345fa5617d79ddaccf78b4e4174a745c..cf90568605878eb17b91a498d9cbc6350b2f070b 100644 (file)
@@ -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:
index b36467776fa28d0050da8297ed83751076f2024e..fb8a0cb5484595a854d0bf1e7abe584ae5e5adfe 100644 (file)
--- 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.