summaryrefslogtreecommitdiffstats
path: root/Lib/tarfile.py
diff options
context:
space:
mode:
authorGeorg Brandl <georg@python.org>2011-08-13 09:48:40 (GMT)
committerGeorg Brandl <georg@python.org>2011-08-13 09:48:40 (GMT)
commit74b6abf61f88221c4c859623a75655dcb214e072 (patch)
tree610a8d7af5e56d45f94ed888adc7e2844b9dbc00 /Lib/tarfile.py
parent3672c4e21f4a886306070512354443f229c5cd0e (diff)
parent3abb372c810c13af4207124c175cfd0a842b5f56 (diff)
downloadcpython-74b6abf61f88221c4c859623a75655dcb214e072.zip
cpython-74b6abf61f88221c4c859623a75655dcb214e072.tar.gz
cpython-74b6abf61f88221c4c859623a75655dcb214e072.tar.bz2
Merge with 3.2.
Diffstat (limited to 'Lib/tarfile.py')
-rw-r--r--Lib/tarfile.py6
1 files changed, 4 insertions, 2 deletions
diff --git a/Lib/tarfile.py b/Lib/tarfile.py
index bd92ded..6bdbf36 100644
--- a/Lib/tarfile.py
+++ b/Lib/tarfile.py
@@ -1802,11 +1802,13 @@ class TarFile(object):
fileobj = gzip.GzipFile(name, mode + "b", compresslevel, fileobj)
t = cls.taropen(name, mode, fileobj, **kwargs)
except IOError:
- if not extfileobj:
+ if not extfileobj and fileobj is not None:
fileobj.close()
+ if fileobj is None:
+ raise
raise ReadError("not a gzip file")
except:
- if not extfileobj:
+ if not extfileobj and fileobj is not None:
fileobj.close()
raise
t._extfileobj = extfileobj