]> granicus.if.org Git - python/commitdiff
I decided to change the interaction between setblocking() and
authorGuido van Rossum <guido@python.org>
Fri, 7 Jun 2002 03:36:20 +0000 (03:36 +0000)
committerGuido van Rossum <guido@python.org>
Fri, 7 Jun 2002 03:36:20 +0000 (03:36 +0000)
settimeout().   Already, settimeout() canceled non-blocking mode; now,
setblocking() also cancels the timeout.  This is easier to document.

(XXX should settimeout(0) be an alias for setblocking(0)?  They seem
to have roughly the same effect.  Also, I'm not sure that the code in
connect() and accept() is correct in all cases.  We'll sort this out
soon enough.)

Modules/socketmodule.c

index 65187c5ce19af734374c915016aa524fa5986d81..49dd33245f0c1ee8d9e121741fe7ce0b997b1fd5 100644 (file)
@@ -1086,11 +1086,8 @@ sock_setblocking(PySocketSockObject *s, PyObject *arg)
                return NULL;
 
        s->sock_blocking = block;
-
-       /* If we're not using timeouts, actually set the blocking to give
-          old python behavior. */
-       if (s->sock_timeout < 0.0)
-               internal_setblocking(s, block);
+       s->sock_timeout = -1.0; /* Always clear the timeout */
+       internal_setblocking(s, block);
 
        Py_INCREF(Py_None);
        return Py_None;