Skip to content

Commit 09307cf

Browse files
committed
Argument Clinic bugfix: Don't let the C preprocessor "Monitor" see lines
that we are scanning for the output marker. If we don't find it, we will scan them again, so it sees them twice, and it can get confused (like thinking we're still in a comment).
1 parent 2c7c6fd commit 09307cf

1 file changed

Lines changed: 4 additions & 3 deletions

File tree

Tools/clinic/clinic.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1252,10 +1252,11 @@ def is_start_line(self, line):
12521252
match = self.start_re.match(line.lstrip())
12531253
return match.group(1) if match else None
12541254

1255-
def _line(self):
1255+
def _line(self, lookahead=False):
12561256
self.line_number += 1
12571257
line = self.input.pop()
1258-
self.language.parse_line(line)
1258+
if not lookahead:
1259+
self.language.parse_line(line)
12591260
return line
12601261

12611262
def parse_verbatim_block(self):
@@ -1311,7 +1312,7 @@ def is_stop_line(line):
13111312
output_add, output_output = text_accumulator()
13121313
arguments = None
13131314
while self.input:
1314-
line = self._line()
1315+
line = self._line(lookahead=True)
13151316
match = checksum_re.match(line.lstrip())
13161317
arguments = match.group(1) if match else None
13171318
if arguments:

0 commit comments

Comments
 (0)