this is expressed better as a for loop
authorBenjamin Peterson <benjamin@python.org>
Sun, 3 Jul 2011 22:23:22 +0000 (17:23 -0500)
committerBenjamin Peterson <benjamin@python.org>
Sun, 3 Jul 2011 22:23:22 +0000 (17:23 -0500)
Objects/genobject.c

index 3fa1b4e726984c6a908335c85e2708d4a771e9e3..cb2980cf78c023b1a1f7535e36e008856cf75f00 100644 (file)
@@ -395,15 +395,13 @@ PyGen_NeedsFinalizing(PyGenObject *gen)
     int i;
     PyFrameObject *f = gen->gi_frame;
 
-    if (f == NULL || f->f_stacktop == NULL || f->f_iblock <= 0)
+    if (f == NULL || f->f_stacktop == NULL)
         return 0; /* no frame or empty blockstack == no finalization */
 
     /* Any block type besides a loop requires cleanup. */
-    i = f->f_iblock;
-    while (--i >= 0) {
+    for (i = 0; i < f->f_iblock; i++)
         if (f->f_blockstack[i].b_type != SETUP_LOOP)
             return 1;
-    }
 
     /* No blocks except loops, it's safe to skip finalization. */
     return 0;