I've come to the conclusion that, as written, the higher level line- oriented protocols which use the socket library (httplib, ftplib, xmlrpclib, etc) won't work with socket timeouts. They generally do something like: self.file = self.sock.makefile('rb') then use file methods to send and receive data on the socket. Alas, the socket docs state: Timeout mode internally sets the socket in non-blocking mode. The blocking and timeout modes are shared between file descriptors and socket objects that refer to the same network endpoint. A consequence of this is that file objects returned by the makefile() method should only be used when the socket is in blocking mode; in timeout or non-blocking mode file operations that cannot be completed immediately will fail. I view this state of affairs as a bug which should be fixed at some point, as these higher level protocol modules are probably the predominant way sockets get used in Python programs.
Logged In: YES user_id=44345 The attached simple patch to socket.py seems to do the trick. No tests fail as a result. The new test_urllibnet test case fails on Mac OS X without the patch and succeeds with the patch.
Logged In: YES user_id=45365 If this patch is accepted: may I request it be done soon? Changes like this often affect how things work on MacOS9 (IOW: break things on MacOS9:-), and in general changing the makefile() semantics on all non-windows platforms is something that may turn up hidden bugs, so I don't think we want this in as a last-second mod before 2.3b1 goes out.
Logged In: YES user_id=33168 This works for me on linux. I don't know if there's any issue wrt to removing _needwrapper. Perhaps it should be checked in and see if anyone complains? I'm not sure who else should review this patch.