provide less mysterious error messages when seeing end-of-line in
single-quoted strings or end-of-file in triple-quoted strings.
closes patch 586561.
diff --git a/Include/errcode.h b/Include/errcode.h
index a8b1aaa..985911e 100644
--- a/Include/errcode.h
+++ b/Include/errcode.h
@@ -26,6 +26,8 @@
 #define E_TOODEEP	20	/* Too many indentation levels */
 #define E_DEDENT	21	/* No matching outer block for dedent */
 #define E_DECODE	22	/* Error in decoding into Unicode */
+#define E_EOFS		23	/* EOF in triple-quoted string */
+#define E_EOLS		24	/* EOL in single-quoted string */
 
 #ifdef __cplusplus
 }
diff --git a/Parser/tokenizer.c b/Parser/tokenizer.c
index 64ff320..7e7a370 100644
--- a/Parser/tokenizer.c
+++ b/Parser/tokenizer.c
@@ -1276,14 +1276,17 @@
 			c = tok_nextc(tok);
 			if (c == '\n') {
 				if (!triple) {
-					tok->done = E_TOKEN;
+					tok->done = E_EOLS;
 					tok_backup(tok, c);
 					return ERRORTOKEN;
 				}
 				tripcount = 0;
 			}
 			else if (c == EOF) {
-				tok->done = E_TOKEN;
+				if (triple)
+					tok->done = E_EOFS;
+				else
+					tok->done = E_EOLS;
 				tok->cur = tok->inp;
 				return ERRORTOKEN;
 			}
@@ -1305,7 +1308,7 @@
 				tripcount = 0;
 				c = tok_nextc(tok);
 				if (c == EOF) {
-					tok->done = E_TOKEN;
+					tok->done = E_EOLS;
 					tok->cur = tok->inp;
 					return ERRORTOKEN;
 				}
diff --git a/Python/pythonrun.c b/Python/pythonrun.c
index 006ff08..28a8e28 100644
--- a/Python/pythonrun.c
+++ b/Python/pythonrun.c
@@ -1247,6 +1247,12 @@
 	case E_TOKEN:
 		msg = "invalid token";
 		break;
+	case E_EOFS:
+		msg = "EOF while scanning triple-quoted string";
+		break;
+	case E_EOLS:
+		msg = "EOL while scanning single-quoted string";
+		break;
 	case E_INTR:
 		PyErr_SetNone(PyExc_KeyboardInterrupt);
 		Py_XDECREF(v);