]> granicus.if.org Git - python/commitdiff
Issue #20243: TarFile no longer raise ReadError when opened in write mode.
authorSerhiy Storchaka <storchaka@gmail.com>
Sat, 18 Jan 2014 14:14:49 +0000 (16:14 +0200)
committerSerhiy Storchaka <storchaka@gmail.com>
Sat, 18 Jan 2014 14:14:49 +0000 (16:14 +0200)
1  2 
Lib/tarfile.py
Lib/test/test_tarfile.py
Misc/NEWS

diff --cc Lib/tarfile.py
index ec8af0649823be118c1a930bdb9f0e97dd11144e,6c40cb95964f7759bcf385dd9b1bd0aabf15df65..d914485c6626ad0ddc102d09bfb13eedf613ff5a
@@@ -1639,9 -1666,11 +1642,11 @@@ class TarFile(object)
  
          try:
              t = cls.taropen(name, mode, fileobj, **kwargs)
 -        except (IOError, EOFError):
 +        except (OSError, EOFError):
              fileobj.close()
-             raise ReadError("not a bzip2 file")
+             if mode == 'r':
+                 raise ReadError("not a bzip2 file")
+             raise
          t._extfileobj = False
          return t
  
Simple merge
diff --cc Misc/NEWS
Simple merge