mirror of
https://github.com/python/cpython.git
synced 2025-10-22 14:42:22 +00:00
Close #17666: Fix reading gzip files with an extra field.
This commit is contained in:
parent
cf86d9441e
commit
a6df938fef
3 changed files with 24 additions and 5 deletions
|
@ -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)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue