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 @@ -1628,10 +1628,16 @@ def parse_clinic_block(self, dsl_name):
16281628 def is_stop_line (line ):
16291629 # make sure to recognize stop line even if it
16301630 # 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} " )
16321640 return False
1633- remainder = line [len (stop_line ):]
1634- return (not remainder ) or remainder .isspace ()
16351641
16361642 # consume body of program
16371643 while self .input :
You can’t perform that action at this time.
0 commit comments