]> granicus.if.org Git - python/commitdiff
Issue #27911: Remove some unnecessary error checks in import.c.
authorBrett Cannon <brett@python.org>
Thu, 8 Sep 2016 00:00:43 +0000 (17:00 -0700)
committerBrett Cannon <brett@python.org>
Thu, 8 Sep 2016 00:00:43 +0000 (17:00 -0700)
Thanks to Xiang Zhang for the patch.

Misc/NEWS
Python/import.c

index 8f9dbab2fb0123a2afa13d40a38d69d4ca8a5304..9daaee2afb4e9cc2f1d71e77d8b215b505280253 100644 (file)
--- a/Misc/NEWS
+++ b/Misc/NEWS
@@ -10,6 +10,9 @@ What's New in Python 3.6.0 beta 1
 Core and Builtins
 -----------------
 
+- Issue #27911: Remove unnecessary error checks in
+  import.c:exec_builtin_or_dynamic().
+
 - Issue #27983: Cause lack of llvm-profdata tool when using clang as
   required for PGO linking to be a configure time error rather than
   make time when --with-optimizations is enabled.  Also improve our
index c780fe29760d641358bdfd093c815270de8fcfa8..17188c275a7e1fd8812d9f38342bd1ef96a2cd86 100644 (file)
@@ -1942,19 +1942,15 @@ exec_builtin_or_dynamic(PyObject *mod) {
 
     def = PyModule_GetDef(mod);
     if (def == NULL) {
-        if (PyErr_Occurred()) {
-            return -1;
-        }
         return 0;
     }
+
     state = PyModule_GetState(mod);
-    if (PyErr_Occurred()) {
-        return -1;
-    }
     if (state) {
         /* Already initialized; skip reload */
         return 0;
     }
+
     return PyModule_ExecDef(mod, def);
 }