DecompressedStream: fix decompression without flush
authorHelmut Grohne <helmut@subdivi.de>
Thu, 9 Jun 2016 20:48:46 +0000 (22:48 +0200)
committerHelmut Grohne <helmut@subdivi.de>
Thu, 9 Jun 2016 20:48:46 +0000 (22:48 +0200)
In Python 3.x, lzma.LZMADecompressor doesn't have a flush method.

dedup/compression.py

index ea431cc..8d1912b 100644 (file)
@@ -117,7 +117,7 @@ class DecompressedStream(object):
             data = self.fileobj.read(self.blocksize)
             if data:
                 self.buff += self.decompressor.decompress(data)
-            else:
+            elif hasattr(self.decompressor, "flush"):
                 self.buff += self.decompressor.flush()
 
     def _read_from_buff(self, length):