bpo-40985: Show correct SyntaxError text when last line has a LINECONT (GH-20888)
When a file ends with a line that contains a line continuation character
the text of the emitted SyntaxError is empty, contrary to the old
parser, where the error text contained the text of the last line.
diff --git a/Lib/test/test_eof.py b/Lib/test/test_eof.py
index bebad31..51cbbd8 100644
--- a/Lib/test/test_eof.py
+++ b/Lib/test/test_eof.py
@@ -52,10 +52,14 @@
file_name = script_helper.make_script(temp_dir, 'foo', '\\')
rc, out, err = script_helper.assert_python_failure(file_name)
self.assertIn(b'unexpected EOF while parsing', err)
+ self.assertIn(b'line 2', err)
+ self.assertIn(b'\\', err)
file_name = script_helper.make_script(temp_dir, 'foo', 'y = 6\\')
rc, out, err = script_helper.assert_python_failure(file_name)
self.assertIn(b'unexpected EOF while parsing', err)
+ self.assertIn(b'line 2', err)
+ self.assertIn(b'y = 6\\', err)
if __name__ == "__main__":
unittest.main()