diff options
author | Serhiy Storchaka <storchaka@gmail.com> | 2013-04-08 19:35:02 (GMT) |
---|---|---|
committer | Serhiy Storchaka <storchaka@gmail.com> | 2013-04-08 19:35:02 (GMT) |
commit | a6df938fefd5b51d85a45cf3f29f60ee7bb21edf (patch) | |
tree | d2a5dd6baa1c9b84b7f17526513ecbb5d18c2f1a /Lib/test/test_gzip.py | |
parent | cf86d9441ed09f0b7265a0a869c110f245336228 (diff) | |
download | cpython-a6df938fefd5b51d85a45cf3f29f60ee7bb21edf.zip cpython-a6df938fefd5b51d85a45cf3f29f60ee7bb21edf.tar.gz cpython-a6df938fefd5b51d85a45cf3f29f60ee7bb21edf.tar.bz2 |
Close #17666: Fix reading gzip files with an extra field.
Diffstat (limited to 'Lib/test/test_gzip.py')
-rw-r--r-- | Lib/test/test_gzip.py | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/Lib/test/test_gzip.py b/Lib/test/test_gzip.py index ba9d7da..b912576 100644 --- a/Lib/test/test_gzip.py +++ b/Lib/test/test_gzip.py @@ -379,6 +379,13 @@ class TestGzip(unittest.TestCase): with gzip.GzipFile(fileobj=io.BytesIO(truncated[:i])) as f: self.assertRaises(EOFError, f.read, 1) + def test_read_with_extra(self): + # Gzip data with an extra field + gzdata = (b'\x1f\x8b\x08\x04\xb2\x17cQ\x02\xff' + b'\x05\x00Extra' + b'\x0bI-.\x01\x002\xd1Mx\x04\x00\x00\x00') + with gzip.GzipFile(fileobj=io.BytesIO(gzdata)) as f: + self.assertEqual(f.read(), b'Test') def test_main(verbose=None): support.run_unittest(TestGzip) |