]> granicus.if.org Git - python/commitdiff
return NULL on error
authorBenjamin Peterson <benjamin@python.org>
Fri, 25 May 2012 07:22:04 +0000 (00:22 -0700)
committerBenjamin Peterson <benjamin@python.org>
Fri, 25 May 2012 07:22:04 +0000 (00:22 -0700)
Modules/zipimport.c

index c33ab8bc971e8d689a583b79ea396f1d1c49e831..5ff39bb75b1e7f74b2773cef614787ecd829b20b 100644 (file)
@@ -381,11 +381,12 @@ zipimporter_find_module(PyObject *obj, PyObject *args)
         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 @@ zipimporter_find_module(PyObject *obj, PyObject *args)
         result = (PyObject *)self;
         break;
     }
-    Py_XINCREF(result);
+    Py_INCREF(result);
     return result;
 }