Kaydet (Commit) 98838bac authored tarafından Nadeem Vawda's avatar Nadeem Vawda

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:'
üst 65bf417f
......@@ -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
This diff is collapsed.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment