[issue24301] gzip module failing to decompress valid compressed file
Martin Panter
report at bugs.python.org
Mon Jun 15 10:17:58 CEST 2015
Martin Panter added the comment:
Just noticed in my previous message I mentioned Issue 1508475 a few times when I meant to say Issue 1159051.
In Python 3.5, a workaround is not so easy because we would need to access the internal buffer of a BufferedReader. One potential workaround is to use read1():
>>> z.read1(1)
b'd'
>>> z.read1()
b'ata'
>>> z.read1()
OSError: Not a gzipped file (b'ga')
The only practical way to allow for an exception and read() returning all the data is to defer the exception until close() is called. Another option might be to store a list of defects, similar to “email.message.Message.defects”.
----------
components: +Library (Lib) -Extension Modules
_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue24301>
_______________________________________
More information about the Python-bugs-list
mailing list