commit | 75c26bc6a78169bf621885fa91b0d8f93241e682 | [log] [tgz] |
---|---|---|
author | Guido van Rossum <guido@python.org> | Tue Aug 07 23:29:20 2007 +0000 |
committer | Guido van Rossum <guido@python.org> | Tue Aug 07 23:29:20 2007 +0000 |
tree | c7d2ca9081ef06f7cb0edbc687fc780e3a385300 | |
parent | a05577059d6ed67f69e9384252647e2232315f2f [diff] [blame] |
BZ2File.read(0) should return b"" rather than raising ValueError. This fixes test_tarfile.py. I've added a unit test for the correct bz2 behavior.
diff --git a/Modules/bz2module.c b/Modules/bz2module.c index ee2186e..954c914 100644 --- a/Modules/bz2module.c +++ b/Modules/bz2module.c
@@ -431,7 +431,7 @@ goto cleanup; } ret = PyBytes_FromStringAndSize((char *)NULL, buffersize); - if (ret == NULL) + if (ret == NULL || buffersize == 0) goto cleanup; bytesread = 0;