In 0.8.15.11, a socket-error handler which wishes to close the socket,
report the FD, etc. must have a local reference to the socket, since
it is unobtainable from the socket-error condition.
Scenario: we want to write a TCP listener generator, which allocates
the socket, binds it to the address, listens on the socket, and then
returns the socket. If the socket is allocated correctly, but the
bind or listen fail, the signalled error doesn't allow the user to
write a handler to, say, close the socket or print out the problem FD.
The attached patch hopefully fixes this; comments welcome. In
particular, making the socket argument be a keyword argument, rather
than an optional, is probably reasonable.