summaryrefslogtreecommitdiffstats
path: root/Parser/parsetok.c
diff options
context:
space:
mode:
Diffstat (limited to 'Parser/parsetok.c')
-rw-r--r--Parser/parsetok.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/Parser/parsetok.c b/Parser/parsetok.c
index cb94721..37ca65c 100644
--- a/Parser/parsetok.c
+++ b/Parser/parsetok.c
@@ -332,6 +332,9 @@ parsetok(struct tok_state *tok, grammar *g, int start, perrdetail *err_ret,
PyParser_AddToken(ps, (int)type, str,
lineno, col_offset, tok->lineno, end_col_offset,
&(err_ret->expected))) != E_OK) {
+ if (tok->done == E_EOF && !ISWHITESPACE(type)) {
+ tok->done = E_SYNTAX;
+ }
if (err_ret->error != E_DONE) {
PyObject_FREE(str);
err_ret->token = type;