Message57234
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. |
| File name |
Uploaded |
|
io4.diff
|
amaury.forgeotdarc,
2007-11-08.12:59:08
|
|
| Date |
User |
Action |
Args |
| 2007-11-08 12:59:10 | amaury.forgeotdarc | set | spambayes_score: 0.00357941 -> 0.00357941 recipients:
+ amaury.forgeotdarc, gvanrossum, draghuram, christian.heimes, alexandre.vassalotti |
| 2007-11-08 12:59:09 | amaury.forgeotdarc | set | spambayes_score: 0.00357941 -> 0.00357941 messageid: <1194526749.8.0.705105055834.issue1395@psf.upfronthosting.co.za> |
| 2007-11-08 12:59:09 | amaury.forgeotdarc | link | issue1395 messages |
| 2007-11-08 12:59:08 | amaury.forgeotdarc | create | |
|