]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
Patch #802188: better parser error message for non-EOL following line cont.
authorMartin v. Löwis <martin@v.loewis.de>
Thu, 3 Mar 2005 11:45:45 +0000 (11:45 +0000)
committerMartin v. Löwis <martin@v.loewis.de>
Thu, 3 Mar 2005 11:45:45 +0000 (11:45 +0000)
Include/errcode.h
Misc/NEWS
Parser/tokenizer.c
Python/pythonrun.c

index 985911eea4fbac879d74989d0244fc317832ef00..becec80c8acfea6ff5c721c164a52d1b7eeb7f26 100644 (file)
@@ -28,6 +28,7 @@ extern "C" {
 #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 */
+#define E_LINECONT     25      /* Unexpected characters after a line continuation */
 
 #ifdef __cplusplus
 }
index d0a8118caed811936abb38bfa7f890ef31ab99aa..baf344544c94315c44af1db5557b9690a1463bf9 100644 (file)
--- a/Misc/NEWS
+++ b/Misc/NEWS
@@ -10,6 +10,9 @@ What's New in Python 2.5 alpha 1?
 Core and builtins
 -----------------
 
+- Patch #802188: Report characters after line continuation character 
+  ('\') with a specific error message.
+
 - Bug #723201: Raise a TypeError for passing bad objects to 'L' format.
 
 - Bug #1124295: the __name__ attribute of file objects was
index 8fc2c267deaba4e42fb03ab292368f5bab2356d7..1884d011e895b0adcad6d44a69318ee04231e7cb 100644 (file)
@@ -1413,7 +1413,7 @@ tok_get(register struct tok_state *tok, char **p_start, char **p_end)
        if (c == '\\') {
                c = tok_nextc(tok);
                if (c != '\n') {
-                       tok->done = E_TOKEN;
+                       tok->done = E_LINECONT;
                        tok->cur = tok->inp;
                        return ERRORTOKEN;
                }
index e9f4765a1e11138ab46737620db31091eb85c071..6d691655cca546c228e05874df0c46e044440826 100644 (file)
@@ -1484,6 +1484,9 @@ err_input(perrdetail *err)
                        msg = "unknown decode error";
                break;
        }
+       case E_LINECONT:
+               msg = "unexpected character after line continuation character";
+               break;
        default:
                fprintf(stderr, "error=%d\n", err->error);
                msg = "unknown parsing error";