File tree 1 file changed +9
-3
lines changed 1 file changed +9
-3
lines changed Original file line number Diff line number Diff line change @@ -1628,10 +1628,16 @@ def parse_clinic_block(self, dsl_name):
1628
1628
def is_stop_line (line ):
1629
1629
# make sure to recognize stop line even if it
1630
1630
# doesn't end with EOL (it could be the very end of the file)
1631
- if not line .startswith (stop_line ):
1631
+ if line .startswith (stop_line ):
1632
+ remainder = line [len (stop_line ):]
1633
+ if remainder and not remainder .isspace ():
1634
+ fail (f"Garbage after stop line: { remainder !r} " )
1635
+ return True
1636
+ else :
1637
+ # gh-92256: don't allow incorrectly formatted stop lines
1638
+ if line .lstrip ().startswith (stop_line ):
1639
+ fail (f"Whitespace is not allowed before the stop line: { line !r} " )
1632
1640
return False
1633
- remainder = line [len (stop_line ):]
1634
- return (not remainder ) or remainder .isspace ()
1635
1641
1636
1642
# consume body of program
1637
1643
while self .input :
You can’t perform that action at this time.
0 commit comments