diff options
author | Lysandros Nikolaou <lisandrosnik@gmail.com> | 2020-04-15 18:22:10 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-04-15 18:22:10 (GMT) |
commit | 9a4b38f66b3e674db94e07980e1cacb39e388c73 (patch) | |
tree | b8046dd0e0b7b9bf0e3592b88c9dc0cd2c7f7ae5 /Tools | |
parent | 574547a75c79b506261520c5773ae08a1dcea1b9 (diff) | |
download | cpython-9a4b38f66b3e674db94e07980e1cacb39e388c73.zip cpython-9a4b38f66b3e674db94e07980e1cacb39e388c73.tar.gz cpython-9a4b38f66b3e674db94e07980e1cacb39e388c73.tar.bz2 |
bpo-40267: Fix message when last input character produces a SyntaxError (GH-19521)
When there is a SyntaxError after reading the last input character from
the tokenizer and if no newline follows it, the error message used to be
`unexpected EOF while parsing`, which is wrong.
Diffstat (limited to 'Tools')
-rwxr-xr-x | Tools/scripts/generate_token.py | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/Tools/scripts/generate_token.py b/Tools/scripts/generate_token.py index f2745e8..77bb5bd 100755 --- a/Tools/scripts/generate_token.py +++ b/Tools/scripts/generate_token.py @@ -69,6 +69,10 @@ extern "C" { #define ISTERMINAL(x) ((x) < NT_OFFSET) #define ISNONTERMINAL(x) ((x) >= NT_OFFSET) #define ISEOF(x) ((x) == ENDMARKER) +#define ISWHITESPACE(x) ((x) == ENDMARKER || \\ + (x) == NEWLINE || \\ + (x) == INDENT || \\ + (x) == DEDENT) PyAPI_DATA(const char * const) _PyParser_TokenNames[]; /* Token names */ |