@@ -3960,31 +3960,33 @@ compiler_from_import(struct compiler *c, stmt_ty s)
39603960static int
39613961compiler_assert (struct compiler * c , stmt_ty s )
39623962{
3963- location loc = LOC (s );
39643963 /* Always emit a warning if the test is a non-zero length tuple */
39653964 if ((s -> v .Assert .test -> kind == Tuple_kind &&
39663965 asdl_seq_LEN (s -> v .Assert .test -> v .Tuple .elts ) > 0 ) ||
39673966 (s -> v .Assert .test -> kind == Constant_kind &&
39683967 PyTuple_Check (s -> v .Assert .test -> v .Constant .value ) &&
39693968 PyTuple_Size (s -> v .Assert .test -> v .Constant .value ) > 0 ))
39703969 {
3971- if (!compiler_warn (c , loc , "assertion is always true, "
3972- "perhaps remove parentheses?" ))
3970+ if (!compiler_warn (c , LOC ( s ) , "assertion is always true, "
3971+ "perhaps remove parentheses?" ))
39733972 {
39743973 return 0 ;
39753974 }
39763975 }
3977- if (c -> c_optimize )
3976+ if (c -> c_optimize ) {
39783977 return 1 ;
3978+ }
39793979 NEW_JUMP_TARGET_LABEL (c , end );
3980- if (!compiler_jump_if (c , & loc , s -> v .Assert .test , end , 1 ))
3980+ location loc = LOC (s );
3981+ if (!compiler_jump_if (c , & loc , s -> v .Assert .test , end , 1 )) {
39813982 return 0 ;
3982- ADDOP (c , loc , LOAD_ASSERTION_ERROR );
3983+ }
3984+ ADDOP (c , LOC (s ), LOAD_ASSERTION_ERROR );
39833985 if (s -> v .Assert .msg ) {
39843986 VISIT (c , expr , s -> v .Assert .msg );
3985- ADDOP_I (c , loc , CALL , 0 );
3987+ ADDOP_I (c , LOC ( s ) , CALL , 0 );
39863988 }
3987- ADDOP_I (c , loc , RAISE_VARARGS , 1 );
3989+ ADDOP_I (c , LOC ( s ) , RAISE_VARARGS , 1 );
39883990
39893991 USE_LABEL (c , end );
39903992 return 1 ;
0 commit comments