[issue22063] asyncio: sock_xxx() methods of event loops should check ath sockets are non-blocking

Guido van Rossum report at bugs.python.org
Thu Jul 31 04:44:46 CEST 2014


Guido van Rossum added the comment:

Hm.  I think there are two different situations.

One is where the app creates a socket (or other I/O thingie), passes it off to asyncio, and then asyncio owns it.  This is the case for pipes and also for the optional sock parameter for create_connection().  In these cases I think it is more robust of asyncio configures the FD for its own needs.

The other case is where the app and asyncio share the socket.  This is the case for e.g. sock_recv().  In this case I think it should be the app's responsibility to configure it properly.  Asyncio can check in debug mode, but otherwise it may be too expensive to check.  (Checking a socket object is actually fine, just check that gettimeout() returns 0; but checking a FD would require a syscall so don't do that in debug mode.)

So the docs for connect_write_pipe() have a bug. :-)

----------

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


More information about the Python-bugs-list mailing list