@@ -3512,45 +3512,46 @@ compiler_try_finally(struct compiler *c, stmt_ty s)
3512
3512
NEW_JUMP_TARGET_LABEL (c , cleanup );
3513
3513
3514
3514
/* `try` block */
3515
- _ADDOP_JUMP (c , loc , SETUP_FINALLY , end );
3515
+ ADDOP_JUMP (c , loc , SETUP_FINALLY , end );
3516
3516
3517
3517
USE_LABEL (c , body );
3518
- if (compiler_push_fblock (c , loc , FINALLY_TRY , body , end , s -> v .Try .finalbody ) < 0 ) {
3519
- return 0 ;
3520
- }
3518
+ RETURN_IF_ERROR (
3519
+ compiler_push_fblock (c , loc , FINALLY_TRY , body , end ,
3520
+ s -> v .Try .finalbody ));
3521
+
3521
3522
if (s -> v .Try .handlers && asdl_seq_LEN (s -> v .Try .handlers )) {
3522
- if (!compiler_try_except (c , s ))
3523
- return 0 ;
3523
+ if (!compiler_try_except (c , s )) {
3524
+ return ERROR ;
3525
+ }
3524
3526
}
3525
3527
else {
3526
- _VISIT_SEQ (c , stmt , s -> v .Try .body );
3528
+ VISIT_SEQ (c , stmt , s -> v .Try .body );
3527
3529
}
3528
- _ADDOP (c , NO_LOCATION , POP_BLOCK );
3530
+ ADDOP (c , NO_LOCATION , POP_BLOCK );
3529
3531
compiler_pop_fblock (c , FINALLY_TRY , body );
3530
- _VISIT_SEQ (c , stmt , s -> v .Try .finalbody );
3532
+ VISIT_SEQ (c , stmt , s -> v .Try .finalbody );
3531
3533
3532
- _ADDOP_JUMP (c , NO_LOCATION , JUMP , exit );
3534
+ ADDOP_JUMP (c , NO_LOCATION , JUMP , exit );
3533
3535
/* `finally` block */
3534
3536
3535
3537
USE_LABEL (c , end );
3536
3538
3537
3539
loc = NO_LOCATION ;
3538
- _ADDOP_JUMP (c , loc , SETUP_CLEANUP , cleanup );
3539
- _ADDOP (c , loc , PUSH_EXC_INFO );
3540
- if (compiler_push_fblock (c , loc , FINALLY_END , end , NO_LABEL , NULL ) < 0 ) {
3541
- return 0 ;
3542
- }
3543
- _VISIT_SEQ (c , stmt , s -> v .Try .finalbody );
3540
+ ADDOP_JUMP (c , loc , SETUP_CLEANUP , cleanup );
3541
+ ADDOP (c , loc , PUSH_EXC_INFO );
3542
+ RETURN_IF_ERROR (
3543
+ compiler_push_fblock (c , loc , FINALLY_END , end , NO_LABEL , NULL ));
3544
+ VISIT_SEQ (c , stmt , s -> v .Try .finalbody );
3544
3545
loc = location_of_last_executing_statement (s -> v .Try .finalbody );
3545
3546
compiler_pop_fblock (c , FINALLY_END , end );
3546
3547
3547
- _ADDOP_I (c , loc , RERAISE , 0 );
3548
+ ADDOP_I (c , loc , RERAISE , 0 );
3548
3549
3549
3550
USE_LABEL (c , cleanup );
3550
- _POP_EXCEPT_AND_RERAISE (c , loc );
3551
+ POP_EXCEPT_AND_RERAISE (c , loc );
3551
3552
3552
3553
USE_LABEL (c , exit );
3553
- return 1 ;
3554
+ return SUCCESS ;
3554
3555
}
3555
3556
3556
3557
static int
@@ -3973,7 +3974,7 @@ compiler_try_star_except(struct compiler *c, stmt_ty s)
3973
3974
static int
3974
3975
compiler_try (struct compiler * c , stmt_ty s ) {
3975
3976
if (s -> v .Try .finalbody && asdl_seq_LEN (s -> v .Try .finalbody ))
3976
- return compiler_try_finally (c , s );
3977
+ return compiler_try_finally (c , s ) == SUCCESS ? 1 : 0 ;
3977
3978
else
3978
3979
return compiler_try_except (c , s );
3979
3980
}
0 commit comments