From 4bf108d74f2e36f16f4c0c00e7791e418e2d47ff Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20v=2E=20L=C3=B6wis?= Date: Thu, 3 Mar 2005 11:45:45 +0000 Subject: Patch #802188: better parser error message for non-EOL following line cont. --- Include/errcode.h | 1 + Misc/NEWS | 3 +++ Parser/tokenizer.c | 2 +- Python/pythonrun.c | 3 +++ 4 files changed, 8 insertions(+), 1 deletion(-) diff --git a/Include/errcode.h b/Include/errcode.h index 985911e..becec80 100644 --- a/Include/errcode.h +++ b/Include/errcode.h @@ -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 } diff --git a/Misc/NEWS b/Misc/NEWS index d0a8118..baf3445 100644 --- 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 diff --git a/Parser/tokenizer.c b/Parser/tokenizer.c index 8fc2c26..1884d01 100644 --- a/Parser/tokenizer.c +++ b/Parser/tokenizer.c @@ -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; } diff --git a/Python/pythonrun.c b/Python/pythonrun.c index e9f4765..6d69165 100644 --- a/Python/pythonrun.c +++ b/Python/pythonrun.c @@ -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"; -- cgit v0.12