[pypy-commit] pypy stdlib-2.7.8: fix tarfile.gzopen so it properly closes

bdkearns noreply at buildbot.pypy.org
Sun Aug 24 22:21:26 CEST 2014


Author: Brian Kearns <bdkearns at gmail.com>
Branch: stdlib-2.7.8
Changeset: r73035:924647338b7e
Date: 2014-08-24 16:21 -0400
http://bitbucket.org/pypy/pypy/changeset/924647338b7e/

Log:	fix tarfile.gzopen so it properly closes

diff --git a/lib-python/2.7/tarfile.py b/lib-python/2.7/tarfile.py
--- a/lib-python/2.7/tarfile.py
+++ b/lib-python/2.7/tarfile.py
@@ -1718,10 +1718,10 @@
         except (ImportError, AttributeError):
             raise CompressionError("gzip module is not available")
 
+        fileobj = gzip.GzipFile(name, mode, compresslevel, fileobj)
+
         try:
-            t = cls.taropen(name, mode,
-                gzip.GzipFile(name, mode, compresslevel, fileobj),
-                **kwargs)
+            t = cls.taropen(name, mode, fileobj, **kwargs)
         except IOError:
             if mode == 'r':
                 raise ReadError("not a gzip file")


More information about the pypy-commit mailing list