From 1b468af7be7a2f0af7730c64402a38cc11413f51 Mon Sep 17 00:00:00 2001
From: Antoine Pitrou <solipsis@pitrou.net>
Date: Wed, 18 Jan 2012 22:30:21 +0100
Subject: [PATCH] Issue #13722: Avoid silencing ImportErrors when initializing
 the codecs registry.

---
 Misc/NEWS       | 3 +++
 Python/codecs.c | 9 ---------
 2 files changed, 3 insertions(+), 9 deletions(-)

diff --git a/Misc/NEWS b/Misc/NEWS
index d6728be60b..7d8cb7b40f 100644
--- a/Misc/NEWS
+++ b/Misc/NEWS
@@ -103,6 +103,9 @@ Core and Builtins
 Library
 -------
 
+- Issue #13722: Avoid silencing ImportErrors when initializing the codecs
+  registry.
+
 - Issue #13781: Fix GzipFile bug that caused an exception to be raised when
   opening for writing using a fileobj returned by os.fdopen().
 
diff --git a/Python/codecs.c b/Python/codecs.c
index 1a3e45774c..c7f4a9cbc1 100644
--- a/Python/codecs.c
+++ b/Python/codecs.c
@@ -1067,15 +1067,6 @@ static int _PyCodecRegistry_Init(void)
 
     mod = PyImport_ImportModuleNoBlock("encodings");
     if (mod == NULL) {
-        if (PyErr_ExceptionMatches(PyExc_ImportError)) {
-            /* Ignore ImportErrors... this is done so that
-               distributions can disable the encodings package. Note
-               that other errors are not masked, e.g. SystemErrors
-               raised to inform the user of an error in the Python
-               configuration are still reported back to the user. */
-            PyErr_Clear();
-            return 0;
-        }
         return -1;
     }
     Py_DECREF(mod);
-- 
2.40.0