[issue9854] SocketIO should return None on EWOULDBLOCK

Giampaolo Rodola' report at bugs.python.org
Wed Sep 15 20:20:54 CEST 2010


Giampaolo Rodola' <g.rodola at gmail.com> added the comment:

> Non-blocking files exist

Of course, I should have been more clear.
What I meant is that there's no such thing as explicit and "native" as setblocking() for plain files.

> Returning None is what raw I/O objects are supposed to do when they 
> fail reading or writing even a single byte. It is designed and 
> documented as such.

>From http://docs.python.org/dev/library/io.html#module-io about io.BufferedIOBase.readinto()

> A BlockingIOError is raised if the underlying raw stream is in non 
> blocking-mode, and has no data available at the moment.

This is valid for BufferedReader, BufferWriter and BufferIOBase classes in various methods while io.RawIOBase.write() and io.RawIOBase.read() return None instead. Shouldn't they raise BlockingIOError as well? Why do they return None?

----------

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue9854>
_______________________________________


More information about the Python-bugs-list mailing list