[issue23056] tarfile raises an exception when reading an empty tar in streaming mode

liu chang report at bugs.python.org
Tue Dec 16 13:02:19 CET 2014


liu chang added the comment:

2232     def next(self):
2233         """Return the next member of the archive as a TarInfo object, when
2234            TarFile is opened for reading. Return None if there is no more
2235            available.
2236         """
2237         self._check("ra")
2238         if self.firstmember is not None:
2239             m = self.firstmember
2240             self.firstmember = None
2241             return m
2242 
2243         # Read the next block.
2244         self.fileobj.seek(self.offset)
2245         tarinfo = None

raise a StreamError at #2244, It should catch this Error and return None. I would like to post a patch to fix it.

----------
nosy: +liu chang

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue23056>
_______________________________________


More information about the Python-bugs-list mailing list