From eb31e9d6edc4fd662a92379cb1007768ad6efeec Mon Sep 17 00:00:00 2001 From: Larry Hastings Date: Mon, 6 Jan 2014 11:10:08 -0800 Subject: [PATCH] Issue #20143: The line numbers reported in Argument Clinic errors are now more accurate. --- Misc/NEWS | 3 +++ Tools/clinic/clinic.py | 5 +++-- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/Misc/NEWS b/Misc/NEWS index 607a3d2c7f5..7750233e363 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 023a034e097..5351b6dcc4c 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)