Martin Panter added the comment:

Patch v9:

* Incorporated _PaddedFile.rewind() into seek() for simplicity
* Reverted to support fast-forwarding in non-seekable streams again
* Factored common checks into _check_can_seek()
* Documented “mtime” attribute and implemented it as a read-only 
decompression-only property

Antoine highlighted the fact that BufferedReader.peek() does not guarantee how 
much data it returns, so I removed the code trying to return at least 100 bytes.

I revisited merging the gzip read() loop with the others, but gave up again. I 
tried adding calls to _start_member() and _end_member(), with more “if” 
statements and flags to account for the different edge cases. But then I 
remembered the “needs_input” flag of LZMA and bzip versus the “unconsumed_tail” 
of zlib. Handling this would probably require another delegation to a new 
_decompress_chunk() method, at which point I think the whole read() method will 
probably just be a mess of hacks trying to marry the two not-quite-compatible 
implementations. So I think it is better to override read() with a 
gzip-specific implementation, unless someone wants to prove me wrong with their 
own patch :)

----------
Added file: http://bugs.python.org/file38733/LZMAFile-etc.v9.patch

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue23529>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to