Python 2.7 does not define ...
...BlockingIOError, InterruptedError
import socket
+try:
+ _CONNECT_ERROR = (BlockingIOError, InterruptedError)
+except:
+ _CONNECT_ERROR = (OSError,)
+
if hasattr(socket, 'socketpair'):
# Since Python 3.5, socket.socketpair() is now also available on Windows
socketpair = socket.socketpair
