This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author amaury.forgeotdarc
Recipients alexandre.vassalotti, amaury.forgeotdarc, christian.heimes, draghuram, gvanrossum
Date 2007-11-08.12:59:08
SpamBayes Score 0.0035794096
Marked as misclassified No
Message-id <1194526749.8.0.705105055834.issue1395@psf.upfronthosting.co.za>
In-reply-to
Content
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.
Files
File name Uploaded
io4.diff amaury.forgeotdarc, 2007-11-08.12:59:08
History
Date User Action Args
2007-11-08 12:59:10amaury.forgeotdarcsetspambayes_score: 0.00357941 -> 0.0035794096
recipients: + amaury.forgeotdarc, gvanrossum, draghuram, christian.heimes, alexandre.vassalotti
2007-11-08 12:59:09amaury.forgeotdarcsetspambayes_score: 0.00357941 -> 0.00357941
messageid: <1194526749.8.0.705105055834.issue1395@psf.upfronthosting.co.za>
2007-11-08 12:59:09amaury.forgeotdarclinkissue1395 messages
2007-11-08 12:59:08amaury.forgeotdarccreate