[Python-Dev] socket timeouts fail w/ makefile()
Guido van Rossum
Thu, 20 Mar 2003 19:57:34 -0500
> I discovered much to my chagrin today that the socket module's new timeout
> capability doesn't play well with file objects as returned by a socket's
> makefile method.
Can you explain better how it doesn't work?
> Tim O'Malley's timeoutsocket module avoids this problem by
> implementing a simple file-like object directly on top of the socket
> without calling makefile(). Is there some reason this approach
> wasn't adopted when adding timeouts to the socket module?
I guess nobody thought of this so far.
> I would think the greatest use of timeouts would be using
> higher-level line-oriented modules like urllib and ftplib. In
> addition, since makefile() isn't always available, it seems
> worthwhile to implement something in socket.py, thus making
> makefile() universally available.
Um, when is makefile() not available? There's code for Windows that
emulates it, returning a file-like object. Maybe that code should be
enabled universally rather than only on Windows...
> I filed a bug report about this issue earlier today in case people
> are interested:
I'm interested, but have no time... :-(
--Guido van Rossum (home page: http://www.python.org/~guido/)