summaryrefslogtreecommitdiffstats
path: root/Lib/gzip.py
diff options
context:
space:
mode:
authorAndrew M. Kuchling <amk@amk.ca>2003-02-05 21:35:07 (GMT)
committerAndrew M. Kuchling <amk@amk.ca>2003-02-05 21:35:07 (GMT)
commit64edd6ac1ddb29f7817ee44e9b376b096ffa1d55 (patch)
tree1dac9b2c32aed3e7beed2cb29aef687acd355504 /Lib/gzip.py
parent570e35870a131dc65dde2835972abb6fdf60a117 (diff)
downloadcpython-64edd6ac1ddb29f7817ee44e9b376b096ffa1d55.zip
cpython-64edd6ac1ddb29f7817ee44e9b376b096ffa1d55.tar.gz
cpython-64edd6ac1ddb29f7817ee44e9b376b096ffa1d55.tar.bz2
[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.
Diffstat (limited to 'Lib/gzip.py')
-rw-r--r--Lib/gzip.py4
1 files changed, 2 insertions, 2 deletions
diff --git a/Lib/gzip.py b/Lib/gzip.py
index 36f9c36..761d941 100644
--- a/Lib/gzip.py
+++ b/Lib/gzip.py
@@ -305,9 +305,9 @@ class GzipFile:
crc32 = read32(self.fileobj)
isize = U32(read32(self.fileobj)) # may exceed 2GB
if U32(crc32) != U32(self.crc):
- raise ValueError, "CRC check failed"
+ raise IOError, "CRC check failed"
elif isize != LOWU32(self.size):
- raise ValueError, "Incorrect length of data produced"
+ raise IOError, "Incorrect length of data produced"
def close(self):
if self.mode == WRITE: