summaryrefslogtreecommitdiffstats
path: root/Parser
diff options
context:
space:
mode:
authorBenjamin Peterson <benjamin@python.org>2016-09-19 06:41:11 (GMT)
committerBenjamin Peterson <benjamin@python.org>2016-09-19 06:41:11 (GMT)
commit26d998cfdd1f843a154e5398d09c0270fa17aa30 (patch)
tree296a49f0685db3c945d9a2d8106414c54742ad18 /Parser
parent354c2f90a15a62005f8a67d1077c4bebaa9df06b (diff)
downloadcpython-26d998cfdd1f843a154e5398d09c0270fa17aa30.zip
cpython-26d998cfdd1f843a154e5398d09c0270fa17aa30.tar.gz
cpython-26d998cfdd1f843a154e5398d09c0270fa17aa30.tar.bz2
properly handle the single null-byte file (closes #24022)
Diffstat (limited to 'Parser')
-rw-r--r--Parser/tokenizer.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/Parser/tokenizer.c b/Parser/tokenizer.c
index 1540d26..1a8cf40 100644
--- a/Parser/tokenizer.c
+++ b/Parser/tokenizer.c
@@ -1014,7 +1014,7 @@ tok_nextc(struct tok_state *tok)
else {
tok->done = E_OK;
tok->inp = strchr(tok->buf, '\0');
- done = tok->inp[-1] == '\n';
+ done = tok->inp == tok->buf || tok->inp[-1] == '\n';
}
}
else {