mirror of
https://github.com/python/cpython.git
synced 2025-08-04 00:48:58 +00:00
Patch #802188: better parser error message for non-EOL following line cont.
This commit is contained in:
parent
a4dac4094a
commit
4bf108d74f
4 changed files with 8 additions and 1 deletions
|
@ -28,6 +28,7 @@ extern "C" {
|
||||||
#define E_DECODE 22 /* Error in decoding into Unicode */
|
#define E_DECODE 22 /* Error in decoding into Unicode */
|
||||||
#define E_EOFS 23 /* EOF in triple-quoted string */
|
#define E_EOFS 23 /* EOF in triple-quoted string */
|
||||||
#define E_EOLS 24 /* EOL in single-quoted string */
|
#define E_EOLS 24 /* EOL in single-quoted string */
|
||||||
|
#define E_LINECONT 25 /* Unexpected characters after a line continuation */
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
}
|
}
|
||||||
|
|
|
@ -10,6 +10,9 @@ What's New in Python 2.5 alpha 1?
|
||||||
Core and builtins
|
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 #723201: Raise a TypeError for passing bad objects to 'L' format.
|
||||||
|
|
||||||
- Bug #1124295: the __name__ attribute of file objects was
|
- Bug #1124295: the __name__ attribute of file objects was
|
||||||
|
|
|
@ -1413,7 +1413,7 @@ tok_get(register struct tok_state *tok, char **p_start, char **p_end)
|
||||||
if (c == '\\') {
|
if (c == '\\') {
|
||||||
c = tok_nextc(tok);
|
c = tok_nextc(tok);
|
||||||
if (c != '\n') {
|
if (c != '\n') {
|
||||||
tok->done = E_TOKEN;
|
tok->done = E_LINECONT;
|
||||||
tok->cur = tok->inp;
|
tok->cur = tok->inp;
|
||||||
return ERRORTOKEN;
|
return ERRORTOKEN;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1484,6 +1484,9 @@ err_input(perrdetail *err)
|
||||||
msg = "unknown decode error";
|
msg = "unknown decode error";
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
case E_LINECONT:
|
||||||
|
msg = "unexpected character after line continuation character";
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
fprintf(stderr, "error=%d\n", err->error);
|
fprintf(stderr, "error=%d\n", err->error);
|
||||||
msg = "unknown parsing error";
|
msg = "unknown parsing error";
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue