]> granicus.if.org Git - python/commitdiff
Issue #20143: The line numbers reported in Argument Clinic errors are
authorLarry Hastings <larry@hastings.org>
Mon, 6 Jan 2014 19:10:08 +0000 (11:10 -0800)
committerLarry Hastings <larry@hastings.org>
Mon, 6 Jan 2014 19:10:08 +0000 (11:10 -0800)
now more accurate.

Misc/NEWS
Tools/clinic/clinic.py

index 607a3d2c7f5471907fb45f8f36b674ce5ec08414..7750233e3631cf5897944ce72802c870d0218753 100644 (file)
--- 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.
 
index 023a034e09761f13dbf6ccb793b7bad7948b49b9..5351b6dcc4c8d586db1d9a828b6b2acd898b6b94 100755 (executable)
@@ -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)