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 <rep...@bugs.python.org> <http://bugs.python.org/issue24301> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com