[Python-Dev] socket timeouts fail w/ makefile()

Skip Montanaro skip@pobox.com
Fri, 21 Mar 2003 06:28:39 -0600


    >> When the socket is in non-blocking mode, reads on the file returned
    >> by .makefile() will fail with an IOError if there is nothing to
    >> return.

    Guido> Isn't that exactly what a timeout is supposed to do?  What would
    Guido> you have expected?

Sorry, I wasn't clear.  It fails immediately.  The timeout isn't observed. 

    >> makefile([mode, [bufsize]]) -- return a file object for the socket [*]\n\
    >> ...
    >> [*] not available on all platforms!");

    Guido> That's the docs for the _socket module, which is (nowadays) an
    Guido> implementation detail.  Read socket.py instead.

Maybe _socket shouldn't have such a detailed doc string or should indicate
its subservient relationship to socket?  I was reading it as if it was a
comment in the code, which, in theory, should still be accurate.

    Guido> Again, I won't have time to do this until after I'm back from
    Guido> Python UK, so I'd appreciate it if someone helped with this,
    Guido> e.g. by filing a patch.

I'll take a look.  There's a bug already in the system
(http://www.python.org/sf/707074) to which a patch could be applied, so if
someone comes up with something, that's where it goes.

Skip