Good sleuthing! Does the attached patch fix it?

(Off-topic: the code is pretty inconsistent about catching BaseException. Maybe it shouldn't be caught at all?)

On Fri, Oct 18, 2013 at 2:04 PM, Richard Oudkerk <> wrote:
On 18/10/2013 9:19pm, Guido van Rossum wrote:
Maybe the dummy socket returned by wrap_socket() is not acceptable for

An error

    SSLError(1, '[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed (_ssl.c:553)')

is being raised in _on_handshake().  This seems to result in the socket being closed without being unregistered from the selector.

select() fails before the SSLError gets reported, so it does not appear in the traceback.


--Guido van Rossum (