This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author ned.deily
Recipients ned.deily, roysmith
Date 2010-11-21.01:46:39
SpamBayes Score 5.133721e-10
Marked as misclassified No
Message-id <1290304001.35.0.619514711074.issue10473@psf.upfronthosting.co.za>
In-reply-to
Content
There is a difference in behavior in the accept() socket call between Linux and BSD systems (including OS X). As documented in the Debian Linux man page for accept(2):  "On Linux, the new socket returned by accept() does not inherit file status flags such as O_NONBLOCK and O_ASYNC from the listening socket.  This behavior differs from the canonical BSD sockets implementation.   Portable  programs should not rely on inheritance or noninheritance of file status flags and always explicitly set all required flags on the socket returned from accept()."

Calling the settimeout method with a positive, non-zero value causes Modules/setsocketmodule.c to set O_NONBLOCK on the listening socket.  On BSDish systems, the accepted socket for the incoming connection inherits that attribute, which causes the recv(2) socket call to return EAGAIN when the received bytes are consumed rather than block, which causes the socket modules SocketIO.readinto() to return None up the chain, which ultimately causes io.TextIOWrapper.readline() to return all that it has received regardless of whether a newline character was received.

It is for that reason that socket.makefile() is documented: "The socket must be in blocking mode (it can not have a timeout)."  Because of the inheritance behavior, the test case fails to adhere to that.
 
http://docs.python.org/py3k/library/socket.html#socket.socket.makefile
History
Date User Action Args
2010-11-21 01:46:41ned.deilysetrecipients: + ned.deily, roysmith
2010-11-21 01:46:41ned.deilysetmessageid: <1290304001.35.0.619514711074.issue10473@psf.upfronthosting.co.za>
2010-11-21 01:46:39ned.deilylinkissue10473 messages
2010-11-21 01:46:39ned.deilycreate