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 /Include | |
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 'Include')
-rw-r--r-- | Include/token.h | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/Include/token.h b/Include/token.h index e08708b..9b8a3aa 100644 --- a/Include/token.h +++ b/Include/token.h @@ -78,6 +78,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 */ |