summaryrefslogtreecommitdiffstats
path: root/Objects
diff options
context:
space:
mode:
authorBenjamin Peterson <benjamin@python.org>2011-07-03 22:23:22 (GMT)
committerBenjamin Peterson <benjamin@python.org>2011-07-03 22:23:22 (GMT)
commitf07c9a1e693359f7f3bedaab55b88f92b5d8c3c9 (patch)
tree5e0ed706f5485e328a93f1fceccf056fbfd3dc37 /Objects
parent9bfd0dee9b80c158cfb4228e7495820a791cd1fb (diff)
downloadcpython-f07c9a1e693359f7f3bedaab55b88f92b5d8c3c9.zip
cpython-f07c9a1e693359f7f3bedaab55b88f92b5d8c3c9.tar.gz
cpython-f07c9a1e693359f7f3bedaab55b88f92b5d8c3c9.tar.bz2
this is expressed better as a for loop
Diffstat (limited to 'Objects')
-rw-r--r--Objects/genobject.c6
1 files changed, 2 insertions, 4 deletions
diff --git a/Objects/genobject.c b/Objects/genobject.c
index 3fa1b4e..cb2980c 100644
--- a/Objects/genobject.c
+++ b/Objects/genobject.c
@@ -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;