]> granicus.if.org Git - python/commitdiff
fix error handling
authorBenjamin Peterson <benjamin@python.org>
Mon, 25 May 2009 20:13:36 +0000 (20:13 +0000)
committerBenjamin Peterson <benjamin@python.org>
Mon, 25 May 2009 20:13:36 +0000 (20:13 +0000)
Modules/future_builtins.c

index 4c840fb161ed2380679064f6e15214eab141600d..bcd42efedba1264b2eb1d0e62fb68c0947c9f1c8 100644 (file)
@@ -85,11 +85,12 @@ initfuture_builtins(void)
        if (itertools == NULL)
                return;
 
+       /* If anything in the following loop fails, we fall through. */
        for (cur_func = it_funcs; *cur_func; ++cur_func){
                iter_func = PyObject_GetAttrString(itertools, *cur_func);
-               if (iter_func == NULL)
-                       return;
-               PyModule_AddObject(m, *cur_func+1, iter_func);
+               if (iter_func == NULL ||
+                   PyModule_AddObject(m, *cur_func+1, iter_func) < 0)
+                       break;
        }
        Py_DECREF(itertools);
        /* any other initialization needed */