]> granicus.if.org Git - python/commitdiff
Fix test_tarfile failure when gzip is not available
authorNeal Norwitz <nnorwitz@gmail.com>
Fri, 11 Apr 2003 03:05:56 +0000 (03:05 +0000)
committerNeal Norwitz <nnorwitz@gmail.com>
Fri, 11 Apr 2003 03:05:56 +0000 (03:05 +0000)
The module would exist, but be empty if already imported.
This change ensures we have gzip available.

Lib/tarfile.py

index 152b23c252c9f82b48581aa7b076e6c1f835fd84..af733deb3233016689260f58acc4ce48720553c9 100644 (file)
@@ -923,7 +923,8 @@ class TarFile(object):
 
         try:
             import gzip
-        except ImportError:
+            gzip.GzipFile
+        except (ImportError, AttributeError):
             raise CompressionError, "gzip module is not available"
 
         pre, ext = os.path.splitext(name)