[issue13322] buffered read() and write() does not raise BlockingIOError
Charles-François Natali
report at bugs.python.org
Sat Nov 5 08:30:23 CET 2011
Charles-François Natali <neologix at free.fr> added the comment:
> write() is a bit simpler, since BlockingIOError has
> a "characters_written" attribute which is meant to inform you of the
> partial success: we can just reuse that. That said, BlockingIOError
> could grow a "partial_read" attribute containing the read result...
Now that I think about it, it's probably the best solution:
always raise a BlockingIOError in case of partial write, with characters_written set correctly (sbt's patch).
And do the same thing on partial read/readline, and return the partially read data as an attribute of BlockingIOError (we could also return a characters_read that would indicate the exact number of bytes read: then the user could call read()/read_into() with exactly characters_read).
That could certainly break existing - sloppy - code, but this would be more much consistent than the current behavior.
----------
_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue13322>
_______________________________________
More information about the Python-bugs-list
mailing list