[docs] socket docs inconsistency (python 2.7.1 over linux)

Georg Brandl georg at python.org
Sat Sep 17 20:24:56 CEST 2011


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Am 15.09.2011 15:42, schrieb Edu Castellano:
> Hi,
> 
> In the documentation of sockets: 
> (http://docs.python.org/release/2.7.1/library/socket.html)
> 
> /socket.setblocking(flag)/ /Set blocking or non-blocking mode of the
> socket: if flag is 0, the socket is set to non-blocking, else to blocking
> mode. Initially all sockets are in blocking mode. In non-blocking mode, if
> a recv() call doesn?t find any data, or if a send() call can?t immediately
> dispose of the data, *a error exception is raised*; in blocking mode, the
> calls block until they can proceed. s.setblocking(0) is equivalent to
> s.settimeout(0.0); s.setblocking(1) is equivalent to s.settimeout(None)./ 
> / / /socket.settimeout(value)/ /Set a timeout on blocking socket
> operations. The value argument can be a nonnegative float expressing
> seconds, or None. If a float is given, subsequent socket operations *will
> raise a timeout exception* if the timeout period value has elapsed before
> the operation has completed. Setting a timeout of None disables timeouts on
> socket operations. s.settimeout(0.0) is equivalent to s.setblocking(0);
> s.settimeout(None) is equivalent to s.setblocking(1)./
> 
> When I'm trying this, I get an "error exception" in both functions. Should
> it be "timeout exception" for settimeout(). I suggest also to raise another
> type of exception in setblocking(), "empty buffer"? or something like
> that.

Hi Edu,

could you show us exactly what code you tried and is raising the wrong exception?

Thanks,
Georg
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.18 (GNU/Linux)

iEYEARECAAYFAk505fgACgkQN9GcIYhpnLCsogCfeTMDP79MJOyCp2tbUb7QHj1t
IwIAnifty7q6tgvnA3VE658nCl2dslTk
=4OSA
-----END PGP SIGNATURE-----


More information about the docs mailing list