summaryrefslogtreecommitdiffstats
path: root/Lib/bz2.py
diff options
context:
space:
mode:
authorNadeem Vawda <nadeem.vawda@gmail.com>2011-05-29 23:12:24 (GMT)
committerNadeem Vawda <nadeem.vawda@gmail.com>2011-05-29 23:12:24 (GMT)
commit98838bac9c1ac67a910e19812e4c9f6e77ef2378 (patch)
tree6de2a7cbfcee95b06cbb629ecce7ae24dce50056 /Lib/bz2.py
parent65bf417fe1e061169c93fd5030611410ad9d0e0e (diff)
downloadcpython-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.py6
1 files changed, 3 insertions, 3 deletions
diff --git a/Lib/bz2.py b/Lib/bz2.py
index 4b25f5d..cc71ae0 100644
--- a/Lib/bz2.py
+++ b/Lib/bz2.py
@@ -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