mirror of
https://github.com/python/cpython.git
synced 2025-08-04 08:59:19 +00:00
this is expressed better as a for loop
This commit is contained in:
parent
9bfd0dee9b
commit
f07c9a1e69
1 changed files with 2 additions and 4 deletions
|
@ -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;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue