diff -ru a/Lib/socket.py b/Lib/socket.py
--- a/Lib/socket.py	2018-04-15 00:06:30.000000000 +0200
+++ b/Lib/socket.py	2018-04-19 14:49:27.227076923 +0200
@@ -51,6 +51,9 @@
 
 try:
     import _ssl
+    from _ssl import SSLError as sslerror
+    # we try this second line since sometimes the first
+    # passes even though the module isn't there
 except ImportError:
     # no SSL support
     pass
@@ -64,7 +67,6 @@
         return _realssl.sslwrap_simple(sock, keyfile, certfile)
 
     # we need to import the same constants we used to...
-    from _ssl import SSLError as sslerror
     from _ssl import \
          RAND_add, \
          RAND_status, \
