mirror of
https://github.com/python/cpython.git
synced 2025-08-04 00:48:58 +00:00
Fix test_tarfile failure when gzip is not available
The module would exist, but be empty if already imported. This change ensures we have gzip available.
This commit is contained in:
parent
ffe33b7f24
commit
4ec6824896
1 changed files with 2 additions and 1 deletions
|
@ -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)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue