From: Antoine Pitrou Date: Thu, 27 Oct 2011 21:59:03 +0000 (+0200) Subject: Update example of non-blocking SSL code for the new finer-grained exceptions X-Git-Tag: v3.3.0a1~1050 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=873bf262ad834cd9465f4fdaca1959e9bf0588f1;p=thirdparty%2FPython%2Fcpython.git Update example of non-blocking SSL code for the new finer-grained exceptions --- diff --git a/Doc/library/ssl.rst b/Doc/library/ssl.rst index 5232f1bdeac9..f1e58131c705 100644 --- a/Doc/library/ssl.rst +++ b/Doc/library/ssl.rst @@ -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: