8000 compiler_while returns SUCCESS/ERROR · python/cpython@42dca92 · GitHub
[go: up one dir, main page]

Skip to content

Commit 42dca92

Browse files
committed
compiler_while returns SUCCESS/ERROR
1 parent 90bb804 commit 42dca92

File tree

1 file changed

+8
-9
lines changed

1 file changed

+8
-9
lines changed

Python/compile.c

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -3358,28 +3358,27 @@ compiler_while(struct compiler *c, stmt_ty s)
33583358
NEW_JUMP_TARGET_LABEL(c, anchor);
33593359

33603360
USE_LABEL(c, loop);
3361-
if (compiler_push_fblock(c, LOC(s), WHILE_LOOP, loop, end, NULL) < 0) {
3362-
return 0;
3363-
}
3361+
3362+
RETURN_IF_ERROR(compiler_push_fblock(c, LOC(s), WHILE_LOOP, loop, end, NULL));
33643363
if (!compiler_jump_if(c, LOC(s), s->v.While.test, anchor, 0)) {
3365-
return 0;
3364+
return ERROR;
33663365
}
33673366

33683367
USE_LABEL(c, body);
3369-
_VISIT_SEQ(c, stmt, s->v.While.body);
3368+
VISIT_SEQ(c, stmt, s->v.While.body);
33703369
if (!compiler_jump_if(c, LOC(s), s->v.While.test, body, 1)) {
3371-
return 0;
3370+
return ERROR;
33723371
}
33733372

33743373
compiler_pop_fblock(c, WHILE_LOOP, loop);
33753374

33763375
USE_LABEL(c, anchor);
33773376
if (s->v.While.orelse) {
3378-
_VISIT_SEQ(c, stmt, s->v.While.orelse);
3377+
VISIT_SEQ(c, stmt, s->v.While.orelse);
33793378
}
33803379

33813380
USE_LABEL(c, end);
3382-
return 1;
3381+
return SUCCESS;
33833382
}
33843383

33853384
static int
@@ -4226,7 +4225,7 @@ compiler_visit_stmt(struct compiler *c, stmt_ty s)
42264225
case For_kind:
42274226
return compiler_for(c, s) == SUCCESS ? 1 : 0;
42284227
case While_kind:
4229-
return compiler_while(c, s);
4228+
return compiler_while(c, s) == SUCCESS ? 1 : 0;
42304229
case If_kind:
42314230
return compiler_if(c, s);
42324231
case Match_kind:

0 commit comments

Comments
 (0)
0