[issue13322] buffered read() and write() does not raise BlockingIOError
sbt
report at bugs.python.org
Fri Nov 4 19:32:17 CET 2011
sbt <shibturn at 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 <report at bugs.python.org>
<http://bugs.python.org/issue13322>
_______________________________________
More information about the Python-bugs-list
mailing list