File tree Expand file tree Collapse file tree 1 file changed +9
-3
lines changed Expand file tree Collapse file tree 1 file changed +9
-3
lines changed Original file line number Diff line number Diff line change @@ -1566,10 +1566,16 @@ def parse_clinic_block(self, dsl_name):
1566
1566
def is_stop_line (line ):
1567
1567
# make sure to recognize stop line even if it
1568
1568
# doesn't end with EOL (it could be the very end of the file)
1569
- if not line .startswith (stop_line ):
1569
+ if line .startswith (stop_line ):
1570
+ remainder = line [len (stop_line ):]
1571
+ if remainder and not remainder .isspace ():
1572
+ fail (f"Garbage after stop line: { remainder !r} " )
1573
+ return True
1574
+ else :
1575
+ # gh-92256: don't allow incorrectly formatted stop lines
1576
+ if line .lstrip ().startswith (stop_line ):
1577
+ fail (f"Whitespace is not allowed before the stop line: { line !r} " )
1570
1578
return False
1571
- remainder = line [len (stop_line ):]
1572
- return (not remainder ) or remainder .isspace ()
1573
1579
1574
1580
# consume body of program
1575
1581
while self .input :
You can’t perform that action at this time.
0 commit comments