socket.error is not a subclass of OSError in Python 2
@@ -3,7 +3,10 @@ import socket
try:
_CONNECT_ERROR = (BlockingIOError, InterruptedError)
except:
- _CONNECT_ERROR = (Exception,)
+ try:
+ _CONNECT_ERROR = (WinError, OSError, socket.error)
+ except:
+ _CONNECT_ERROR = (OSError, socket.error)
if hasattr(socket, 'socketpair'):
# Since Python 3.5, socket.socketpair() is now also available on Windows
