Author sbt
Recipients benjamin.peterson, neologix, petri.lehtinen, pitrou, sbt, stutzbach
Date 2011-11-04.18:32:16
SpamBayes Score 4.94049e-15
Marked as misclassified No
Message-id <1320431537.86.0.425143296084.issue13322@psf.upfronthosting.co.za>
In-reply-to
Content
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...
History
Date User Action Args
2011-11-04 18:32:17sbtsetrecipients: + sbt, pitrou, benjamin.peterson, stutzbach, neologix, petri.lehtinen
2011-11-04 18:32:17sbtsetmessageid: <1320431537.86.0.425143296084.issue13322@psf.upfronthosting.co.za>
2011-11-04 18:32:17sbtlinkissue13322 messages
2011-11-04 18:32:16sbtcreate