Oleg Oshmyan <chor...@inbox.lv> added the comment:

I believe the attached patch fixes this problem, making zlib.Decompress.flush() 
raise the exception raised by zlib.decompress().

In the same patch, I also took the opportunity to correct a wrong comment in 
the implementation of flush() and change the error messages given by 
zlib.{De,C}ompress.flush() on {in,de}flateEnd() errors to the more 
end-user-friendly ones given in the same occasions by zlib.{de,}compress(). If 
this does not sound like a good thing to do, feel free (whoever ends up 
committing this) to remove these changes.

One uncomfortable issue I see with the patch is that zlib.Decompress.flush() 
now potentially gives an error message with Z_OK as the error code, but unless 
I misunderstand the comments in the real zlib’s zlib.h and that never happens 
(I was unable to produce a situation that would cause this), the only other 
options are faking another error code and setting an exception message whose 
format is different from all other exceptions raised by the zlib module.

----------
keywords: +patch
Added file: http://bugs.python.org/file22782/zlib.Decompress.flush.patch

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

Reply via email to