sbt <shibt...@gmail.com> added the comment: Currently a BlockingIOError exception raised by flush() sets characters_written to the number of bytes fushed from the internal buffer. This is undocument (although there is a unit test which tests for it) and causes confusion because characters_written has conflicting meanings depending on whether the exception was raised by flush() or write(). I would propose setting characters_written to zero on BlockingIOError exceptions raised by flush(). Are there any reasons not to make this change?
Also, the docs say that the raw file wrapped by BufferedReader/BufferedWriter should implement RawIOBase. This means that self.raw.write() should return None instead of raising BlockingIOError. But the implementation tries to cope with BlockingIOError coming from a raw write. In fact, the MockNonBlockWriterIO class in unit tests is used as a raw file, but its write() method raises BlockingIOError. It would simplify matters a lot to insist that raw files implement RawIOBase properly. BTW, when I try to change characters_written of an existing BlockingIOError exception using the pointer returned by _buffered_check_blocking_error(), it appears not to work: the exception continues to have characters_written == 0 -- not sure why... ---------- _______________________________________ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue13322> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com