diff -r 60163fc72017 Lib/tarfile.py --- a/Lib/tarfile.py Mon Jan 13 13:51:42 2014 -0500 +++ b/Lib/tarfile.py Mon Jan 13 22:25:47 2014 +0200 @@ -1641,6 +1641,9 @@ except (OSError, EOFError): fileobj.close() raise ReadError("not a bzip2 file") + except: + fileobj.close() + raise t._extfileobj = False return t @@ -1664,6 +1667,9 @@ except (lzma.LZMAError, EOFError): fileobj.close() raise ReadError("not an lzma file") + except: + fileobj.close() + raise t._extfileobj = False return t