summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAntoine Pitrou <solipsis@pitrou.net>2011-10-27 21:59:03 (GMT)
committerAntoine Pitrou <solipsis@pitrou.net>2011-10-27 21:59:03 (GMT)
commit873bf262ad834cd9465f4fdaca1959e9bf0588f1 (patch)
treeb9297829345ef4339b9695bcb7b9a446ba5472f9
parent41032a69c12c1d4939daa84c98b2726f00380a9e (diff)
downloadcpython-873bf262ad834cd9465f4fdaca1959e9bf0588f1.zip
cpython-873bf262ad834cd9465f4fdaca1959e9bf0588f1.tar.gz
cpython-873bf262ad834cd9465f4fdaca1959e9bf0588f1.tar.bz2
Update example of non-blocking SSL code for the new finer-grained exceptions
-rw-r--r--Doc/library/ssl.rst11
1 files changed, 4 insertions, 7 deletions
diff --git a/Doc/library/ssl.rst b/Doc/library/ssl.rst
index 5232f1b..f1e5813 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: