Skip to content

Commit 698aeab

Browse files
author
georg.brandl
committed
#2816: clarify error messages for EOF while scanning strings.
git-svn-id: http://svn.python.org/projects/python/trunk@63068 6015fed2-1504-0410-9fe1-9d1591cc4771
1 parent 15c6e05 commit 698aeab

File tree

2 files changed

+5
-4
lines changed

2 files changed

+5
-4
lines changed

Lib/test/test_eof.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66

77
class EOFTestCase(unittest.TestCase):
88
def test_EOFC(self):
9-
expect = "EOL while scanning single-quoted string (<string>, line 1)"
9+
expect = "EOL while scanning string literal (<string>, line 1)"
1010
try:
1111
eval("""'this is a test\
1212
""")
@@ -16,7 +16,8 @@ def test_EOFC(self):
1616
raise test_support.TestFailed
1717

1818
def test_EOFS(self):
19-
expect = "EOF while scanning triple-quoted string (<string>, line 1)"
19+
expect = ("EOF while scanning triple-quoted string literal "
20+
"(<string>, line 1)")
2021
try:
2122
eval("""'''this is a test""")
2223
except SyntaxError, msg:

Python/pythonrun.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1500,10 +1500,10 @@ err_input(perrdetail *err)
15001500
msg = "invalid token";
15011501
break;
15021502
case E_EOFS:
1503-
msg = "EOF while scanning triple-quoted string";
1503+
msg = "EOF while scanning triple-quoted string literal";
15041504
break;
15051505
case E_EOLS:
1506-
msg = "EOL while scanning single-quoted string";
1506+
msg = "EOL while scanning string literal";
15071507
break;
15081508
case E_INTR:
15091509
if (!PyErr_Occurred())

0 commit comments

Comments
 (0)