summaryrefslogtreecommitdiffstats
path: root/Lib
diff options
context:
space:
mode:
authorLysandros Nikolaou <lisandrosnik@gmail.com>2020-06-16 00:27:33 (GMT)
committerGitHub <noreply@github.com>2020-06-16 00:27:33 (GMT)
commit113e2b0a07c72c0d5e3489076afb14f6b3ad1049 (patch)
tree286d9d282f1e5290706475f2409bc4e332bd2738 /Lib
parent8666356280084f0426c28a981341f72eaaacd006 (diff)
downloadcpython-113e2b0a07c72c0d5e3489076afb14f6b3ad1049.zip
cpython-113e2b0a07c72c0d5e3489076afb14f6b3ad1049.tar.gz
cpython-113e2b0a07c72c0d5e3489076afb14f6b3ad1049.tar.bz2
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.
Diffstat (limited to 'Lib')
-rw-r--r--Lib/test/test_eof.py4
1 files changed, 4 insertions, 0 deletions
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 @@ class EOFTestCase(unittest.TestCase):
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()