Message75563
The patch is good.
I was first surprised by the fact that e.characters_written is not used
in the write() method; but _flush_unlocked() already adjusts the
_write_buf according to the original e.characters_written raised by the
underlying raw file. Everything is fine.
I suggest however to add some tests around the first "except
BlockingIOError". This would answer the question:
# XXX Why not just let the exception pass through?
For example, I modified a function in your patch:
def testWriteNonBlockingOverage(self):
raw = MockNonBlockWriterIO((-1, -2))
[...]
# Subsequent calls to write() try to flush the raw file.
try:
bufio.write(b"x")
except io.BlockingIOError as e:
# Two more chars were written at the raw level
self.assertEqual(bufio._write_buf, write_buf[2:])
# But write() did not accept anything.
self.assertEqual(e.characters_written, 0)
else:
self.fail("BlockingIOError not raised") |
|
Date |
User |
Action |
Args |
2008-11-06 13:34:51 | amaury.forgeotdarc | set | recipients:
+ amaury.forgeotdarc, severb |
2008-11-06 13:34:51 | amaury.forgeotdarc | set | messageid: <1225978491.66.0.626111845294.issue4263@psf.upfronthosting.co.za> |
2008-11-06 13:34:51 | amaury.forgeotdarc | link | issue4263 messages |
2008-11-06 13:34:50 | amaury.forgeotdarc | create | |
|