@@ -3389,41 +3389,41 @@ compiler_return(struct compiler *c, stmt_ty s)
3389
3389
location loc = LOC (s );
3390
3390
int preserve_tos = ((s -> v .Return .value != NULL ) &&
3391
3391
(s -> v .Return .value -> kind != Constant_kind ));
3392
- if (c -> u -> u_ste -> ste_type != FunctionBlock )
3393
- return compiler_error (c , loc , "'return' outside function" );
3392
+ if (c -> u -> u_ste -> ste_type != FunctionBlock ) {
3393
+ compiler_error (c , loc , "'return' outside function" );
3394
+ return ERROR ;
3395
+ }
3394
3396
if (s -> v .Return .value != NULL &&
3395
3397
c -> u -> u_ste -> ste_coroutine && c -> u -> u_ste -> ste_generator )
3396
3398
{
3397
- return compiler_error (
3398
- c , loc , "' return' with value in async generator" ) ;
3399
+ compiler_error ( c , loc , "'return' with value in async generator" );
3400
+ return ERROR ;
3399
3401
}
3400
3402
3401
3403
if (preserve_tos ) {
3402
- _VISIT (c , expr , s -> v .Return .value );
3404
+ VISIT (c , expr , s -> v .Return .value );
3403
3405
} else {
3404
3406
/* Emit instruction with line number for return value */
3405
3407
if (s -> v .Return .value != NULL ) {
3406
3408
loc = LOC (s -> v .Return .value );
3407
- _ADDOP (c , loc , NOP );
3409
+ ADDOP (c , loc , NOP );
3408
3410
}
3409
3411
}
3410
3412
if (s -> v .Return .value == NULL || s -> v .Return .value -> lineno != s -> lineno ) {
3411
3413
loc = LOC (s );
3412
- _ADDOP (c , loc , NOP );
3414
+ AD
8000
DOP (c , loc , NOP );
3413
3415
}
3414
3416
3415
- if (compiler_unwind_fblock_stack (c , & loc , preserve_tos , NULL ) < 0 ) {
3416
- return 0 ;
3417
- }
3417
+ RETURN_IF_ERROR (compiler_unwind_fblock_stack (c , & loc , preserve_tos , NULL ));
3418
3418
if (s -> v .Return .value == NULL ) {
3419
- _ADDOP_LOAD_CONST (c , loc , Py_None );
3419
+ ADDOP_LOAD_CONST (c , loc , Py_None );
3420
3420
}
3421
3421
else if (!preserve_tos ) {
3422
- _ADDOP_LOAD_CONST (c , loc , s -> v .Return .value -> v .Constant .value );
3422
+ ADDOP_LOAD_CONST (c , loc , s -> v .Return .value -> v .Constant .value );
3423
3423
}
3424
- _ADDOP (c , loc , RETURN_VALUE );
3424
+ ADDOP (c , loc , RETURN_VALUE );
3425
3425
3426
- return 1 ;
3426
+ return SUCCESS ;
3427
3427
}
3428
3428
3429
3429
static int
@@ -4203,7 +4203,7 @@ compiler_visit_stmt(struct compiler *c, stmt_ty s)
4203
4203
case ClassDef_kind :
4204
4204
return compiler_class (c , s ) == SUCCESS ? 1 : 0 ;
4205
4205
case Return_kind :
4206
- return compiler_return (c , s );
4206
+ return compiler_return (c , s ) == SUCCESS ? 1 : 0 ;
4207
4207
case Delete_kind :
4208
4208
_VISIT_SEQ (c , expr , s -> v .Delete .targets )
4209
4209
break ;
0 commit comments