@@ -630,7 +630,7 @@ def parse_arg_list(self, allow_signature: bool = True,
630
630
elif self .current_str () in ['*' , '**' ]:
631
631
if bare_asterisk_before == len (args ):
632
632
# named arguments must follow bare *
633
- self .parse_error ()
633
+ raise self .parse_error ()
634
634
635
635
arg = self .parse_asterisk_arg (
636
636
allow_signature ,
@@ -991,7 +991,7 @@ def parse_return_stmt(self) -> ReturnStmt:
991
991
expr = None
992
992
current = self .current ()
993
993
if current .string == 'yield' :
994
- self .parse_error ()
994
+ raise self .parse_error ()
995
995
if not isinstance (current , Break ):
996
996
expr = self .parse_expression ()
997
997
node = ReturnStmt (expr )
@@ -1247,10 +1247,10 @@ def parse_print_stmt(self) -> PrintStmt:
1247
1247
if self .current_str () == ',' :
1248
1248
self .skip ()
1249
1249
if isinstance (self .current (), Break ):
1250
- self .parse_error ()
1250
+ raise self .parse_error ()
1251
1251
else :
1252
1252
if not isinstance (self .current (), Break ):
1253
- self .parse_error ()
1253
+ raise self .parse_error ()
1254
1254
comma = False
1255
1255
while not isinstance (self .current (), Break ):
1256
1256
args .append (self .parse_expression (precedence [',' ]))
@@ -1325,7 +1325,7 @@ def parse_expression(self, prec: int = 0, star_expr_allowed: bool = False) -> Ex
1325
1325
expr = self .parse_ellipsis ()
1326
1326
else :
1327
1327
# Invalid expression.
1328
- self .parse_error ()
1328
+ raise self .parse_error ()
1329
1329
1330
1330
# Set the line of the expression node, if not specified. This
1331
1331
# simplifies recording the line number as not every node type needs to
@@ -1500,7 +1500,7 @@ def parse_dict_or_set_expr(self) -> Union[SetComprehension, SetExpr,
1500
1500
elif self .current_str () == 'for' and items == []:
1501
1501
return self .parse_set_comprehension (key )
1502
1502
elif self .current_str () != ':' :
1503
- self .parse_error ()
1503
+ raise self .parse_error ()
1504
1504
colon = self .expect (':' )
1505
1505
value = self .parse_expression (precedence ['<for>' ])
1506
1506
if self .current_str () == 'for' and items == []:
@@ -1670,7 +1670,7 @@ def parse_arg_expr(self) -> Tuple[List[Expression], List[int], List[str]]:
1670
1670
kinds .append (nodes .ARG_POS )
1671
1671
names .append (None )
1672
1672
else :
1673
- self .parse_error ()
1673
+ raise self .parse_error ()
1674
1674
args .append (self .parse_expression (precedence [',' ]))
1675
1675
if self .current_str () != ',' :
1676
1676
break
@@ -1738,7 +1738,7 @@ def parse_bin_op_expr(self, left: Expression, prec: int) -> OpExpr:
1738
1738
op_str = op .string
1739
1739
if op_str == '~' :
1740
1740
self .ind -= 1
1741
- self .parse_error ()
1741
+ raise self .parse_error ()
1742
1742
right = self .parse_expression (prec )
1743
1743
node = OpExpr (op_str , left , right )
1744
1744
return node
@@ -1755,7 +1755,7 @@ def parse_comparison_expr(self, left: Expression, prec: int) -> ComparisonExpr:
1755
1755
op_str = 'not in'
1756
1756
self .skip ()
1757
1757
else :
1758
- self .parse_error ()
1758
+ raise self .parse_error ()
1759
1759
elif op_str == 'is' and self .current_str () == 'not' :
1760
1760
op_str = 'is not'
1761
1761
self .skip ()
0 commit comments