Serhiy Storchaka added the comment:

Actually previous patch doesn't fix original problem, it only ensure that 
GzipFile consistent with BZ2File and LZMAFile.

To fix original problem we need other patch, and this patch looks as new 
feature for 3.4. Here is a sample patch for LZMAFile. BZ2File patch will be 
similar, and GzipFile patch will be more different and complex.

Now error doesn't raised immediately when read the file unexpectedly ended if 
some data can be read. Instead maximal possible part of read data returned and 
exception raising deferred to next read (see tests).

Perhaps we need a new flag for constructor or for read() which enables a new 
behavior (what will be a good name for this?). Or we can use a special value 
for size argument which means "read to the end as much as possible" (we can 
differentiate the behavior for size<0 and size=None). Unconditional enabling a 
new behavior for size >=0 is safe.

----------
type: behavior -> enhancement
versions:  -Python 2.7, Python 3.2, Python 3.3
Added file: http://bugs.python.org/file28809/lzma_deferred_error.patch

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

Reply via email to