Errata

Python Standard Library

Errata for Python Standard Library

Submit your own errata for this product.

The errata list is a list of errors and their corrections that were found after the product was released.

The following errata were submitted by our customers and have not yet been approved or disproved by the author or editor. They solely represent the opinion of the customer.

Color Key: Serious technical mistake Minor technical mistake Language or formatting error Typo Question Note Update

Version Location Description Submitted by Date submitted
Printed Page 169
Third bullet, select module

The paragraph claims that "a socket signals an error condition when the connection
fails after a non-blocking call to connect".

To the best of my knowledge that is not correct. The third fd-set passed to select is
the "exceptional" fd-set. The only way for a bit to be set there is appearance of
urgent (OOB) data on a TCP socket. Perhaps there are some platforms that set a bit
there on error conditions, but nothing that can be universally relied upon. Checking
the Linux 2.4 kernel code, urgent data is the only way that bit gets set (look for
POLLPRI setting in net/ipv4/*.c)

Stevens writes in "Advanced Programming in the UNIX Environment", page 400: "[...] an
exception condition corresponds to (a) the arrival of out-of-band data on a network
connection, or (b) certain conditions occurring on a pseudo terminal that has been
placed into packet mode".

Confusingly, the Single Unix Specification v2 describes the fd_set as error fd_set
rather than "exceptional".

To get back to non-blocking sockets: to *just* check whether an error ocurred on a
non-blocking socket you need to wait for the socket to become writable and then use
getsockopt with SOL_SOCKET / SO_ERROR to check if there's a pending error. You can of
course just read() as well, but then you will have to read at least 1 byte and handle
the error that will occur if there is no data available.

Anonymous   
Printed Page 200
Example 7-38, Top Left.

The example is aimed at being run on a *nix machine, as it uses the "ForkingTPCServer
" method. Changing the SocketServer.ForkingTPCServer to
SocketServer.ThreadingTCPServer enables it to run under Win32.

Anonymous   
Printed Page 208
Example 9-4

The wrong example is printed. File SimpleAsyncHTTP.py appears instead of something
to do with AIFC.

Anonymous   
Printed Page 208
source code

Wrong source code: the correct example is the file "aifc-example-1.py" found on the CD.

Anonymous