[issue7995] On Mac / BSD sockets returned by accept inherit the parent's FD flags
Kristján Valur Jónsson
report at bugs.python.org
Wed Mar 30 18:15:25 CEST 2011
Kristján Valur Jónsson <kristjan at ccpgames.com> added the comment:
socket.defaulttimeout(None)
s = socket.socket()
s.settimeout(0) #nonblocking
s.bind()
s2, a = s.accept()
print s2.gettimeout() #prints ´none´, meaning blocking
s2.receive(10) #raises EWOULDBLOCK error, since internally it is non-blocking
I don't agree with practicality vs. purity, particularly when trying to understand the timeout logic. Most of the timeout logic is implemented in c and never touched by python, in init_sockobject(). But then you tack on extra logic in socket.py, in what is even a socket object wrapper. This means that any module that uses the "pure" _socket.socket object, such as C extensions, will not get the "correct" behaviour.
----------
_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue7995>
_______________________________________
More information about the Python-bugs-list
mailing list