]> 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 7e4a300a6f98055b2898c55e40b60e3cce9215de..4fdbad93934197e9273caffdb74839850c633191 100644 (file)
@@ -951,7 +951,7 @@ tok_nextc(register 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 {