From: Larry Hastings Date: Mon, 6 Jan 2014 19:10:08 +0000 (-0800) Subject: Issue #20143: The line numbers reported in Argument Clinic errors are X-Git-Tag: v3.4.0b3~230 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=eb31e9d6edc4fd662a92379cb1007768ad6efeec;p=python Issue #20143: The line numbers reported in Argument Clinic errors are now more accurate. --- diff --git a/Misc/NEWS b/Misc/NEWS index 607a3d2c7f..7750233e36 100644 --- a/Misc/NEWS +++ b/Misc/NEWS @@ -16,6 +16,9 @@ Library Tools/Demos ----------- +- Issue #20143: The line numbers reported in Argument Clinic errors are + now more accurate. + - Issue #20142: Py_buffer variables generated by Argument Clinic are now initialized with a default value. diff --git a/Tools/clinic/clinic.py b/Tools/clinic/clinic.py index 023a034e09..5351b6dcc4 100755 --- a/Tools/clinic/clinic.py +++ b/Tools/clinic/clinic.py @@ -943,8 +943,9 @@ class BlockParser: fail("Checksum mismatch!\nExpected: {}\nComputed: {}".format(checksum, computed)) else: # put back output - self.input.extend(reversed(output.splitlines(keepends=True))) - self.line_number -= len(output) + output_lines = output.splitlines(keepends=True) + self.line_number -= len(output_lines) + self.input.extend(reversed(output_lines)) output = None return Block(input_output(), dsl_name, output=output)