[Python-checkins] cpython: return NULL on error

benjamin.peterson python-checkins at python.org
Fri May 25 09:22:03 CEST 2012


http://hg.python.org/cpython/rev/9554a27b5b19
changeset:   77132:9554a27b5b19
user:        Benjamin Peterson <benjamin at python.org>
date:        Fri May 25 00:22:04 2012 -0700
summary:
  return NULL on error

files:
  Modules/zipimport.c |  5 +++--
  1 files changed, 3 insertions(+), 2 deletions(-)


diff --git a/Modules/zipimport.c b/Modules/zipimport.c
--- a/Modules/zipimport.c
+++ b/Modules/zipimport.c
@@ -381,11 +381,12 @@
         return NULL;
 
     switch (find_loader(self, fullname, &namespace_portion)) {
+    case fl_error:
+        return NULL;
     case fl_ns_found:
         /* A namespace portion is not allowed via find_module, so return None. */
         Py_DECREF(namespace_portion);
         /* FALL THROUGH */
-    case fl_error:
     case fl_not_found:
         result = Py_None;
         break;
@@ -393,7 +394,7 @@
         result = (PyObject *)self;
         break;
     }
-    Py_XINCREF(result);
+    Py_INCREF(result);
     return result;
 }
 

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


More information about the Python-checkins mailing list