[New-bugs-announce] [issue6584] gzip module has no custom exception

Sridhar Ratnakumar report at bugs.python.org
Mon Jul 27 08:10:50 CEST 2009


New submission from Sridhar Ratnakumar <sridharr at activestate.com>:

Much like zipfile.BadZipfile, we need a base custom exception for the 
gzip module. At least, catch gzip-related exceptions and throw a 
tarfile.TarError when used *via* tarfile.*.

See the following example (the exception escaped the "try... except 
tarfile.TarError: .. " block!):

***
  [...]
  File "/home/sridharr/as/pypm/src/pypm/common/compression.py", line 
199, in _ensure_read_write_access
    for tarinfo in tarfileobj.getmembers():
  File "/opt/ActivePython-2.6/lib/python2.6/tarfile.py", line 1791, in 
getmembers
    self._load()        # all members, we first have to
  File "/opt/ActivePython-2.6/lib/python2.6/tarfile.py", line 2352, in 
_load
    tarinfo = self.next()
  File "/opt/ActivePython-2.6/lib/python2.6/tarfile.py", line 2307, in 
next
    self.fileobj.seek(self.offset)
  File "/opt/ActivePython-2.6/lib/python2.6/gzip.py", line 382, in seek
    self.read(1024)
  File "/opt/ActivePython-2.6/lib/python2.6/gzip.py", line 219, in read
    self._read(readsize)
  File "/opt/ActivePython-2.6/lib/python2.6/gzip.py", line 284, in _read
    self._read_eof()
  File "/opt/ActivePython-2.6/lib/python2.6/gzip.py", line 304, in 
_read_eof
    hex(self.crc)))
IOError: CRC check failed 0x115929f0 != 0x9f074a38L

----------
components: Library (Lib)
messages: 90976
nosy: srid
severity: normal
status: open
title: gzip module has no custom exception
type: behavior
versions: Python 2.6

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


More information about the New-bugs-announce mailing list