Alexander Belopolsky <belopol...@users.sourceforge.net> added the comment:
On Wed, Feb 23, 2011 at 10:22 AM, Antoine Pitrou <rep...@bugs.python.org> wrote: .. > Well, a theoretical argument could be made that some codec could return > a non-empty string when asked to decode an empty bytestring, but I'm not > sure it has much practical worth :) I was thinking about that as well. Note that the opposite is quite common, for example any encoding that uses BOM will turn empty unicode string into a non-empty byte string. I don't think a codec that decodes b'' into non-empty string exists, but it would be reasonable for a codec that requires BOM or some other metadata to reject raise an error on b''. If we rely on decode(b'') == '', these errors will go unnoticed. I am going to prepare a Unpickler_Read() patch with tests and play with it a little. It is a good idea to separate performance optimizations from bug fixes anyways. If we want to bypass decode on empty strings, we can do it independently. ---------- _______________________________________ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue11286> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com