fix fpscr table parser error reporting
authorJacob Lifshay <programmerjake@gmail.com>
Sat, 6 May 2023 03:38:22 +0000 (20:38 -0700)
committerLuke Kenneth Casson Leighton <lkcl@lkcl.net>
Fri, 2 Jun 2023 18:51:17 +0000 (19:51 +0100)
src/openpower/fpscr.py

index 98e5ed9ef9c71a5650a6a2b8836fe24a8941b3f0..3da88f1683e6f718ea62d8d8d916e6ccd194b739 100644 (file)
@@ -129,12 +129,12 @@ def _parse_fields():
         nonlocal lineno
         if err_lineno is None:
             err_lineno = lineno
+        line = lines[err_lineno]
         for i in range(10000):  # 10000 is random limit if we can't read
             if linecache.getline(__file__, i).strip().startswith('"'):
                 break
             err_lineno += 1  # lines before doc comment start
-        raise SyntaxError(msg, (
-            __file__, err_lineno + 3, col, lines[err_lineno]))
+        raise SyntaxError(msg, (__file__, err_lineno, col, line))
 
     for lineno, line in enumerate(lines):
         line_fields = _parse_line_fields(line)