]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
properly handle the single null-byte file (closes #24022)
authorBenjamin Peterson <benjamin@python.org>
Mon, 19 Sep 2016 06:41:11 +0000 (23:41 -0700)
committerBenjamin Peterson <benjamin@python.org>
Mon, 19 Sep 2016 06:41:11 +0000 (23:41 -0700)
Parser/tokenizer.c

index 1540d26d8b3b26b6ff149ef51a473582d9649166..1a8cf40c2ce44822edcbbec493f38e322f6258fa 100644 (file)
@@ -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 {