]> granicus.if.org Git - python/commitdiff
Issue #5689: Avoid excessive memory usage by using the default lzma preset.
authorLars Gustäbel <lars@gustaebel.de>
Wed, 18 Jan 2012 13:01:17 +0000 (14:01 +0100)
committerLars Gustäbel <lars@gustaebel.de>
Wed, 18 Jan 2012 13:01:17 +0000 (14:01 +0100)
Lib/tarfile.py

index 5c9d3a8f3558501d9cb39d63ca88e3365180f218..e3380a2d6b3f5f0534ce3582169f22c849e3b5c0 100644 (file)
@@ -1807,7 +1807,7 @@ class TarFile(object):
         return t
 
     @classmethod
-    def xzopen(cls, name, mode="r", fileobj=None, preset=9, **kwargs):
+    def xzopen(cls, name, mode="r", fileobj=None, preset=None, **kwargs):
         """Open lzma compressed tar archive name for reading or writing.
            Appending is not allowed.
         """
@@ -1819,10 +1819,6 @@ class TarFile(object):
         except ImportError:
             raise CompressionError("lzma module is not available")
 
-        if mode == "r":
-            # LZMAFile complains about a preset argument in read mode.
-            preset = None
-
         fileobj = lzma.LZMAFile(filename=name if fileobj is None else None,
                 mode=mode, fileobj=fileobj, preset=preset)