@@ -6632,9 +6632,7 @@ pattern_helper_sequence_unpack(struct compiler *c, location loc,
6632
6632
// One less item to keep track of each time we loop through:
6633
6633
pc -> on_top -- ;
6634
6634
pattern_ty pattern = asdl_seq_GET (patterns , i );
6635
- if (!compiler_pattern_subpattern (c , pattern , pc )) {
6636
- return ERROR ;
6637
- }
6635
+ RETURN_IF_ERROR (compiler_pattern_subpattern (c , pattern , pc ));
6638
6636
}
6639
6637
return SUCCESS ;
6640
6638
}
@@ -6659,24 +6657,24 @@ pattern_helper_sequence_subscr(struct compiler *c, location loc,
6659
6657
assert (WILDCARD_STAR_CHECK (pattern ));
6660
6658
continue ;
6661
6659
}
6662
- _ADDOP_I (c , loc , COPY , 1 );
6660
+ ADDOP_I (c , loc , COPY , 1 );
6663
6661
if (i < star ) {
6664
- _ADDOP_LOAD_CONST_NEW (c , loc , PyLong_FromSsize_t (i ));
6662
+ ADDOP_LOAD_CONST_NEW (c , loc , PyLong_FromSsize_t (i ));
6665
6663
}
6666
6664
else {
6667
6665
// The subject may not support negative indexing! Compute a
6668
6666
// nonnegative index:
6669
- _ADDOP (c , loc , GET_LEN );
6670
- _ADDOP_LOAD_CONST_NEW (c , loc , PyLong_FromSsize_t (size - i ));
6671
- _ADDOP_BINARY (c , loc , Sub );
6667
+ ADDOP (c , loc , GET_LEN );
6668
+ ADDOP_LOAD_CONST_NEW (c , loc , PyLong_FromSsize_t (size - i ));
6669
+ ADDOP_BINARY (c , loc , Sub );
6672
6670
}
6673
- _ADDOP (c , loc , BINARY_SUBSCR );
<
8000
tr class="diff-line-row">6674
- RETURN_IF_FALSE (compiler_pattern_subpattern (c , pattern , pc ));
6671
+ ADDOP (c , loc , BINARY_SUBSCR );
6672
+ RETURN_IF_ERROR (compiler_pattern_subpattern (c , pattern , pc ));
6675
6673
}
6676
6674
// Pop the subject, we're done with it:
6677
6675
pc -> on_top -- ;
6678
- _ADDOP (c , loc , POP_TOP );
6679
- return 1 ;
6676
+ ADDOP (c , loc , POP_TOP );
6677
+ return SUCCESS ;
6680
6678
}
6681
6679
6682
6680
// Like compiler_pattern, but turn off checks for irrefutability.
@@ -6686,9 +6684,11 @@ compiler_pattern_subpattern(struct compiler *c,
6686
6684
{
6687
6685
int allow_irrefutable = pc -> allow_irrefutable ;
6688
6686
pc -> allow_irrefutable = 1 ;
6689
- RETURN_IF_FALSE (compiler_pattern (c , p , pc ));
6687
+ if (!compiler_pattern (c , p , pc )) {
6688
+ return ERROR ;
6689
+ }
6690
6690
pc -> allow_irrefutable = allow_irrefutable ;
6691
- return 1 ;
6691
+ return SUCCESS ;
6692
6692
}
6693
6693
6694
6694
static int
@@ -6811,7 +6811,9 @@ compiler_pattern_class(struct compiler *c, pattern_ty p, pattern_context *pc)
6811
6811
_ADDOP (c , LOC (p ), POP_TOP );
6812
6812
continue ;
6813
6813
}
6814
- RETURN_IF_FALSE (compiler_pattern_subpattern (c , pattern , pc ));
6814
+ if (compiler_pattern_subpattern (c , pattern , pc ) < 0 ) {
6815
+ return 0 ;
6816
+ }
6815
6817
}
6816
6818
// Success! Pop the tuple of attributes:
6817
6819
return 1 ;
@@ -6924,7 +6926,9 @@ compiler_pattern_mapping(struct compiler *c, pattern_ty p,
6924
6926
for (Py_ssize_t i = 0 ; i < size ; i ++ ) {
6925
6927
pc -> on_top -- ;
6926
6928
pattern_ty pattern = asdl_seq_GET (patterns , i );
6927
- RETURN_IF_FALSE (compiler_pattern_subpattern (c , pattern , pc ));
6929
+ if (compiler_pattern_subpattern (c , pattern , pc ) < 0 ) {
6930
+ return 0 ;
6931
+ }
6928
6932
}
6929
6933
// If we get this far, it's a match! Whatever happens next should consume
6930
6934
// the tuple of keys and the subject:
@@ -7168,7 +7172,9 @@ compiler_pattern_sequence(struct compiler *c, pattern_ty p,
7168
7172
_ADDOP (c , LOC (p ), POP_TOP );
7169
7173
}
7170
7174
else if (star_wildcard ) {
7171
- RETURN_IF_FALSE (pattern_helper_sequence_subscr (c , LOC (p ), patterns , star , pc ));
7175
+ if (pattern_helper_sequence_subscr (c , LOC (p ), patterns , star , pc ) < 0 ) {
7176
+ return 0 ;
7177
+ }
7172
7178
}
7173
7179
else {
7174
7180
if (pattern_helper_sequence_unpack (c , LOC (p ), patterns , star , pc ) < 0 ) {
0 commit comments