@@ -2841,8 +2841,7 @@ check_compare(struct compiler *c, expr_ty e)
2841
2841
const char * msg = (op == Is )
2842
2842
? "\"is\" with a literal. Did you mean \"==\"?"
2843
2843
: "\"is not\" with a literal. Did you mean \"!=\"?" ;
2844
- int ret = compiler_warn (c , LOC (e ), msg );
2845
- return ret == 0 ? ERROR : SUCCESS ;
2844
+ return compiler_warn (c , LOC (e ), msg );
2846
2845
}
2847
2846
}
2848
2847
left = right ;
@@ -3968,11 +3967,9 @@ compiler_assert(struct compiler *c, stmt_ty s)
3968
3967
PyTuple_Check (s -> v .Assert .test -> v .Constant .value ) &&
3969
3968
PyTuple_Size (s -> v .Assert .test -> v .Constant .value ) > 0 ))
3970
3969
{
3971
- if (!compiler_warn (c , LOC (s ), "assertion is always true, "
3972
- "perhaps remove parentheses?" ))
3973
- {
3974
- return ERROR ;
3975
- }
3970
+ RETURN_IF_ERROR (
3971
+ compiler_warn (c , LOC (s ), "assertion is always true, "
3972
+ "perhaps remove parentheses?" ));
3976
3973
}
3977
3974
if (c -> c_optimize ) {
3978
3975
return SUCCESS ;
@@ -4679,10 +4676,9 @@ check_caller(struct compiler *c, expr_ty e)
4679
4676
case JoinedStr_kind :
4680
4677
case FormattedValue_kind : {
4681
4678
location loc = LOC (e );
4682
- int ret = compiler_warn (c , loc , "'%.200s' object is not callable; "
4683
- "perhaps you missed a comma?" ,
4684
- infer_type (e )-> tp_name );
4685
- return ret == 0 ? ERROR : SUCCESS ;
4679
+ return compiler_warn (c , loc , "'%.200s' object is not callable; "
4680
+ "perhaps you missed a comma?" ,
4681
+ infer_type (e )-> tp_name );
4686
4682
}
4687
4683
default :
4688
4684
return SUCCESS ;
@@ -4709,10 +4705,9 @@ check_subscripter(struct compiler *c, expr_ty e)
4709
4705
case GeneratorExp_kind :
4710
4706
case Lambda_kind : {
4711
4707
location loc = LOC (e );
4712
- int ret = compiler_warn (c , loc , "'%.200s' object is not subscriptable; "
4713
- "perhaps you missed a comma?" ,
4714
- infer_type (e )-> tp_name );
4715
- return ret == 0 ? ERROR : SUCCESS ;
4708
+ return compiler_warn (c , loc , "'%.200s' object is not subscriptable; "
4709
+ "perhaps you missed a comma?" ,
4710
+ infer_type (e )-> tp_name );
4716
4711
}
4717
4712
default :
4718
4713
return SUCCESS ;
@@ -4744,12 +4739,11 @@ check_index(struct compiler *c, expr_ty e, expr_ty s)
4744
4739
case JoinedStr_kind :
4745
4740
case FormattedValue_kind : {
4746
4741
location loc = LOC (e );
4747
- int ret = compiler_warn (c , loc , "%.200s indices must be integers "
4748
- "or slices, not %.200s; "
4749
- "perhaps you missed a comma?" ,
4750
- infer_type (e )-> tp_name ,
4751
- index_type -> tp_name );
4752
- return ret == 0 ? ERROR : SUCCESS ;
4742
+ return compiler_warn (c , loc , "%.200s indices must be integers "
4743
+ "or slices, not %.200s; "
4744
+ "perhaps you missed a comma?" ,
4745
+ infer_type (e )-> tp_name ,
4746
+ index_type -> tp_name );
4753
4747
}
4754
4748
default :
4755
4749
return SUCCESS ;
@@ -6155,7 +6149,7 @@ compiler_warn(struct compiler *c, location loc,
6155
6149
PyObject * msg = PyUnicode_FromFormatV (format , vargs );
6156
6150
va_end (vargs );
6157
6151
if (msg == NULL ) {
6158
- return 0 ;
6152
+ return ERROR ;
6159
6153
}
6160
6154
if (PyErr_WarnExplicitObject (PyExc_SyntaxWarning , msg , c -> c_filename ,
6161
6155
loc .lineno , NULL , NULL ) < 0 )
@@ -6168,10 +6162,10 @@ compiler_warn(struct compiler *c, location loc,
6168
6162
compiler_error (c , loc , PyUnicode_AsUTF8 (msg ));
6169
6163
}
6170
6164
Py_DECREF (msg );
6171
- return 0 ;
6165
+ return ERROR ;
6172
6166
}
6173
6167
Py_DECREF (msg );
6174
- return 1 ;
6168
+ return SUCCESS ;
6175
6169
}
6176
6170
6177
6171
static int
0 commit comments