summaryrefslogtreecommitdiff
path: root/Objects/genobject.c
diff options
context:
space:
mode:
authorAntoine Pitrou <solipsis@pitrou.net>2011-12-18 19:29:06 +0100
committerAntoine Pitrou <solipsis@pitrou.net>2011-12-18 19:29:06 +0100
commit5c2b6c1fc611cca464a8b42c1472fa180a2fd09d (patch)
treebb425b5c9fbcba04adb0cf51a4bb7450d15df4eb /Objects/genobject.c
parent0eb4aa847cd4a61b443072f6fae843c7203cc474 (diff)
parent0da3531a6234054d1da980a506c27f35a2c45046 (diff)
downloadcpython-5c2b6c1fc611cca464a8b42c1472fa180a2fd09d.tar.gz
Issue #7502: Fix equality comparison for DocTestCase instances.
Patch by Cédric Krier.
Diffstat (limited to 'Objects/genobject.c')
-rw-r--r--Objects/genobject.c6
1 files changed, 2 insertions, 4 deletions
diff --git a/Objects/genobject.c b/Objects/genobject.c
index 42608eff36..c6612e26d5 100644
--- a/Objects/genobject.c
+++ b/Objects/genobject.c
@@ -410,15 +410,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;