[Python-checkins] python/dist/src/Lib gzip.py,1.37,1.38

akuchling@users.sourceforge.net akuchling@users.sourceforge.net
Wed, 05 Feb 2003 13:35:12 -0800


Update of /cvsroot/python/python/dist/src/Lib
In directory sc8-pr-cvs1:/tmp/cvs-serv25917

Modified Files:
	gzip.py 
Log Message:
[Patch #654421 from Matthew Mueller] 
  gzip shouldn't raise ValueError on corrupt files

  Currently the gzip module will raise a ValueError if the file was
  corrupt (bad crc or bad size).  I can't see how that applies to
  reading a corrupt file.  IOError seems better, and it's what code
  will likely be looking for.


Index: gzip.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Lib/gzip.py,v
retrieving revision 1.37
retrieving revision 1.38
diff -C2 -d -r1.37 -r1.38
*** gzip.py	5 Nov 2002 20:38:54 -0000	1.37
--- gzip.py	5 Feb 2003 21:35:07 -0000	1.38
***************
*** 306,312 ****
          isize = U32(read32(self.fileobj))   # may exceed 2GB
          if U32(crc32) != U32(self.crc):
!             raise ValueError, "CRC check failed"
          elif isize != LOWU32(self.size):
!             raise ValueError, "Incorrect length of data produced"
  
      def close(self):
--- 306,312 ----
          isize = U32(read32(self.fileobj))   # may exceed 2GB
          if U32(crc32) != U32(self.crc):
!             raise IOError, "CRC check failed"
          elif isize != LOWU32(self.size):
!             raise IOError, "Incorrect length of data produced"
  
      def close(self):