Re: [Python-Dev] Modules/socketmodule.c: avoiding second fcntl() call worth the effort?

2013-01-20 Thread Victor Stinner
Since Linux 2.6.27, it's possible to set SOCK_NONBLOCK directly at the creation of the socket (using socket() and accept4()). So you don't need any extra call. I implemented something similar for SOCK_CLOEXEC flag to implement the PEP 433. See for example: http://hg.python.org/features/pep-433/fil

Re: [Python-Dev] Modules/socketmodule.c: avoiding second fcntl() call worth the effort?

2013-01-20 Thread Peter Portante
FWIW, looking into Python's Lib/socket.py module, it would seem that the dup() method of a _sockobject() just transfers the underlying fd, not performing a new socket create. So a caller could know about that behavior and work to call setblocking(0) only when it has a socket not seen before. In ev