summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGuido van Rossum <guido@python.org>2013-11-23 23:36:43 (GMT)
committerGuido van Rossum <guido@python.org>2013-11-23 23:36:43 (GMT)
commit7fa6e1aeea111e7d954b753fb483afc18f21add0 (patch)
tree84037c8c0d022c8be76eb91215aaba56ffc53497
parent085869bfeeaeecaa79fd4ea9b55fc48f2fe08f05 (diff)
downloadcpython-7fa6e1aeea111e7d954b753fb483afc18f21add0.zip
cpython-7fa6e1aeea111e7d954b753fb483afc18f21add0.tar.gz
cpython-7fa6e1aeea111e7d954b753fb483afc18f21add0.tar.bz2
Keep asyncio working with Python 3.3 too.
-rw-r--r--Lib/asyncio/selector_events.py11
1 files changed, 9 insertions, 2 deletions
diff --git a/Lib/asyncio/selector_events.py b/Lib/asyncio/selector_events.py
index 14c9700..0641459 100644
--- a/Lib/asyncio/selector_events.py
+++ b/Lib/asyncio/selector_events.py
@@ -571,8 +571,15 @@ class _SelectorSslTransport(_SelectorTransport):
# context; in that case the sslcontext passed is None.
# The default is the same as used by urllib with
# cadefault=True.
- sslcontext = ssl._create_stdlib_context(
- cert_reqs=ssl.CERT_REQUIRED)
+ if hasattr(ssl, '_create_stdlib_context'):
+ sslcontext = ssl._create_stdlib_context(
+ cert_reqs=ssl.CERT_REQUIRED)
+ else:
+ # Fallback for Python 3.3.
+ sslcontext = ssl.SSLContext(ssl.PROTOCOL_SSLv23)
+ sslcontext.options |= ssl.OP_NO_SSLv2
+ sslcontext.set_default_verify_paths()
+ sslcontext.verify_mode = ssl.CERT_REQUIRED
wrap_kwargs = {
'server_side': server_side,