8000 compiler_for returns SUCCESS/ERROR · python/cpython@90bb804 · GitHub
[go: up one dir, main page]

Skip to content

Commit 90bb804

Browse files
committed
compiler_for returns SUCCESS/ERROR
1 parent 40615da commit 90bb804

File tree

1 file changed

+12
-13
lines changed

1 file changed

+12
-13
lines changed

Python/compile.c

Lines changed: 12 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -3272,30 +3272,29 @@ compiler_for(struct compiler *c, stmt_ty s)
32723272
NEW_JUMP_TARGET_LABEL(c, cleanup);
32733273
NEW_JUMP_TARGET_LABEL(c, end);
32743274

3275-
if (compiler_push_fblock(c, loc, FOR_LOOP, start, end, NULL) < 0) {
3276-
return 0;
3277-
}
3278-
_VISIT(c, expr, s->v.For.iter);
3279-
_ADDOP(c, loc, GET_ITER);
3275+
RETURN_IF_ERROR(compiler_push_fblock(c, loc, FOR_LOOP, start, end, NULL));
3276+
3277+
VISIT(c, expr, s->v.For.iter);
3278+
ADDOP(c, loc, GET_ITER);
32803279

32813280
USE_LABEL(c, start);
3282-
_ADDOP_JUMP(c, loc, FOR_ITER, cleanup);
3281+
ADDOP_JUMP(c, loc, FOR_ITER, cleanup);
32833282

32843283
USE_LABEL(c, body);
3285-
_VISIT(c, expr, s->v.For.target);
3286-
_VISIT_SEQ(c, stmt, s->v.For.body);
3284+
VISIT(c, expr, s->v.For.target);
3285+
VISIT_SEQ(c, stmt, s->v.For.body);
32873286
/* Mark jump as artificial */
3288-
_ADDOP_JUMP(c, NO_LOCATION, JUMP, start);
3287+
ADDOP_JUMP(c, NO_LOCATION, JUMP, start);
32893288

32903289
USE_LABEL(c, cleanup);
3291-
_ADDOP(c, NO_LOCATION, END_FOR);
3290+
ADDOP(c, NO_LOCATION, END_FOR);
32923291

32933292
compiler_pop_fblock(c, FOR_LOOP, start);
32943293

3295-
_VISIT_SEQ(c, stmt, s->v.For.orelse);
3294+
VISIT_SEQ(c, stmt, s->v.For.orelse);
32963295

32973296
USE_LABEL(c, end);
3298-
return 1;
3297+
return SUCCESS;
32993298
}
33003299

33013300

@@ -4225,7 +4224,7 @@ compiler_visit_stmt(struct compiler *c, stmt_ty s)
42254224
case AnnAssign_kind:
42264225
return compiler_annassign(c, s) == SUCCESS ? 1 : 0;
42274226
case For_kind:
4228-
return compiler_for(c, s);
4227+
return compiler_for(c, s) == SUCCESS ? 1 : 0;
42294228
case While_kind:
42304229
return compiler_while(c, s);
42314230
case If_kind:

0 commit comments

Comments
 (0)
0