diff options
author | Nadeem Vawda <nadeem.vawda@gmail.com> | 2011-05-29 23:12:24 (GMT) |
---|---|---|
committer | Nadeem Vawda <nadeem.vawda@gmail.com> | 2011-05-29 23:12:24 (GMT) |
commit | 98838bac9c1ac67a910e19812e4c9f6e77ef2378 (patch) | |
tree | 6de2a7cbfcee95b06cbb629ecce7ae24dce50056 /Lib/bz2.py | |
parent | 65bf417fe1e061169c93fd5030611410ad9d0e0e (diff) | |
download | cpython-98838bac9c1ac67a910e19812e4c9f6e77ef2378.zip cpython-98838bac9c1ac67a910e19812e4c9f6e77ef2378.tar.gz cpython-98838bac9c1ac67a910e19812e4c9f6e77ef2378.tar.bz2 |
Miscellaneous cleanups to bz2 and test_bz2 following issue #1625.
* In bz2.decompress(), concatenate partial results in a way that should
be more friendly to other Python implementations
* Remove redundant comments in test_bz2
* Use 'while True:' instead of 'while 1:'
Diffstat (limited to 'Lib/bz2.py')
-rw-r--r-- | Lib/bz2.py | 6 |
1 files changed, 3 insertions, 3 deletions
@@ -400,14 +400,14 @@ def decompress(data): if len(data) == 0: return b"" - result = b"" + results = [] while True: decomp = BZ2Decompressor() - result += decomp.decompress(data) + results.append(decomp.decompress(data)) if not decomp.eof: raise ValueError("Compressed data ended before the " "end-of-stream marker was reached") if not decomp.unused_data: - return result + return b"".join(results) # There is unused data left over. Proceed to next stream. data = decomp.unused_data |