[Python-checkins] cpython (3.2): Issue #13722: Avoid silencing ImportErrors when initializing the codecs

antoine.pitrou python-checkins at python.org
Wed Jan 18 22:35:47 CET 2012


http://hg.python.org/cpython/rev/46b245f03f54
changeset:   74511:46b245f03f54
branch:      3.2
parent:      74506:5ffa409af22e
user:        Antoine Pitrou <solipsis at pitrou.net>
date:        Wed Jan 18 22:30:21 2012 +0100
summary:
  Issue #13722: Avoid silencing ImportErrors when initializing the codecs registry.

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


diff --git a/Misc/NEWS b/Misc/NEWS
--- a/Misc/NEWS
+++ b/Misc/NEWS
@@ -103,6 +103,9 @@
 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
--- a/Python/codecs.c
+++ b/Python/codecs.c
@@ -1067,15 +1067,6 @@
 
     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);

-- 
Repository URL: http://hg.python.org/cpython


More information about the Python-checkins mailing list