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 amaury.forgeotdarc, severb
Date 2008-11-06.13:34:50
SpamBayes Score 4.5592486e-07
Marked as misclassified No
Message-id <1225978491.66.0.626111845294.issue4263@psf.upfronthosting.co.za>
In-reply-to
Content
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")
History
Date User Action Args
2008-11-06 13:34:51amaury.forgeotdarcsetrecipients: + amaury.forgeotdarc, severb
2008-11-06 13:34:51amaury.forgeotdarcsetmessageid: <1225978491.66.0.626111845294.issue4263@psf.upfronthosting.co.za>
2008-11-06 13:34:51amaury.forgeotdarclinkissue4263 messages
2008-11-06 13:34:50amaury.forgeotdarccreate