Kaydet (Commit) f07c9a1e authored tarafından Benjamin Peterson's avatar Benjamin Peterson

this is expressed better as a for loop

üst 9bfd0dee
...@@ -395,15 +395,13 @@ PyGen_NeedsFinalizing(PyGenObject *gen) ...@@ -395,15 +395,13 @@ PyGen_NeedsFinalizing(PyGenObject *gen)
int i; int i;
PyFrameObject *f = gen->gi_frame; 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 */ return 0; /* no frame or empty blockstack == no finalization */
/* Any block type besides a loop requires cleanup. */ /* Any block type besides a loop requires cleanup. */
i = f->f_iblock; for (i = 0; i < f->f_iblock; i++)
while (--i >= 0) {
if (f->f_blockstack[i].b_type != SETUP_LOOP) if (f->f_blockstack[i].b_type != SETUP_LOOP)
return 1; return 1;
}
/* No blocks except loops, it's safe to skip finalization. */ /* No blocks except loops, it's safe to skip finalization. */
return 0; return 0;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment