]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
Update example of non-blocking SSL code for the new finer-grained exceptions
authorAntoine Pitrou <solipsis@pitrou.net>
Thu, 27 Oct 2011 21:59:03 +0000 (23:59 +0200)
committerAntoine Pitrou <solipsis@pitrou.net>
Thu, 27 Oct 2011 21:59:03 +0000 (23:59 +0200)
Doc/library/ssl.rst

index 5232f1bdeac9cb10cf0095a559e4a974188a3f68..f1e58131c705ddd7fd59cb7d96df4aed9294ca41 100644 (file)
@@ -1044,13 +1044,10 @@ to be aware of:
         try:
             sock.do_handshake()
             break
-        except ssl.SSLError as err:
-            if err.args[0] == ssl.SSL_ERROR_WANT_READ:
-                select.select([sock], [], [])
-            elif err.args[0] == ssl.SSL_ERROR_WANT_WRITE:
-                select.select([], [sock], [])
-            else:
-                raise
+        except ssl.SSLWantReadError:
+            select.select([sock], [], [])
+        except ssl.SSLWantWriteError:
+            select.select([], [sock], [])
 
 
 .. _ssl-security: