Amaury Forgeot d'Arc added the comment: OK, I have taken another approach which seems to work (see io4.diff): It uses an IncrementalNewlineDecoder, which wraps the initial (e.g. utf-8) decoder. All the tests in test_io pass on Windows, including those added by io.diff and io2.diff. This was not the case with the other proposed patches.
While not completely finished, this approach seems much saner to me: it is simple, does not introduce obscure variables or functions, and is compatible with the (complex) code in tell() which reconstruct the file position. Next steps are: - move _seennl management inside this decoder, and remove _replacenl - make the decoder directly inherit from codecs.IncrementalDecoder; code may be easier to understand. - fix test_mailbox. About mailbox.py: it seems that the code cannot work: it uses statements like self._file.read(stop - self._file.tell()) where 'stop' was previously initialized with some other call to self._file.tell(). But read() counts characters, whereas tell() returns byte counts. The question is now: how does it work with python2.5? I'll try to add debug prints to see where the differences are. Added file: http://bugs.python.org/file8711/io4.diff __________________________________ Tracker <[EMAIL PROTECTED]> <http://bugs.python.org/issue1395> __________________________________
io4.diff
Description: Binary data
_______________________________________________ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com