Amaury Forgeot d'Arc <[EMAIL PROTECTED]> added the comment: 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") ---------- nosy: +amaury.forgeotdarc _______________________________________ Python tracker <[EMAIL PROTECTED]> <http://bugs.python.org/issue4263> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com