]> granicus.if.org Git - python/commit
Merged revisions 76443 via svnmerge from
authorLars Gustäbel <lars@gustaebel.de>
Sun, 22 Nov 2009 18:48:49 +0000 (18:48 +0000)
committerLars Gustäbel <lars@gustaebel.de>
Sun, 22 Nov 2009 18:48:49 +0000 (18:48 +0000)
commit9520a430efb88e129f6c416b8f65c56fec884ecd
tree057251aec6b3003f325ac19106b41dbfa10a576f
parentf08adb36d8cfd24e70d48e3d0ccc14e44cac095b
Merged revisions 76443 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk

........
  r76443 | lars.gustaebel | 2009-11-22 19:30:53 +0100 (Sun, 22 Nov 2009) | 24 lines

  Issue #6123: Fix opening empty archives and files.

  (Note that an empty archive is not the same as an empty file. An
  empty archive contains no members and is correctly terminated with an
  EOF block full of zeros. An empty file contains no data at all.)

  The problem was that although tarfile was able to create empty
  archives, it failed to open them raising a ReadError. On the other
  hand, tarfile opened empty files without error in most read modes and
  presented them as empty archives. (However, some modes still raised
  errors: "r|gz" raised ReadError, but "r:gz" worked, "r:bz2" even
  raised EOFError.)

  In order to get a more fine-grained control over the various internal
  error conditions I now split up the HeaderError exception into a
  number of meaningful sub-exceptions. This makes it easier in the
  TarFile.next() method to react to the different conditions in the
  correct way.

  The visible change in its behaviour now is that tarfile will open
  empty archives correctly and raise ReadError consistently for empty
  files.
........
Lib/tarfile.py
Lib/test/test_tarfile.py
Misc/NEWS