[Python-checkins] cpython: Keep asyncio working with Python 3.3 too.

guido.van.rossum python-checkins at python.org
Sun Nov 24 00:36:50 CET 2013


http://hg.python.org/cpython/rev/8c98d0900b0f
changeset:   87469:8c98d0900b0f
user:        Guido van Rossum <guido at python.org>
date:        Sat Nov 23 15:36:43 2013 -0800
summary:
  Keep asyncio working with Python 3.3 too.

files:
  Lib/asyncio/selector_events.py |  11 +++++++++--
  1 files changed, 9 insertions(+), 2 deletions(-)


diff --git a/Lib/asyncio/selector_events.py b/Lib/asyncio/selector_events.py
--- a/Lib/asyncio/selector_events.py
+++ b/Lib/asyncio/selector_events.py
@@ -571,8 +571,15 @@
                 # 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,

-- 
Repository URL: http://hg.python.org/cpython


More information about the Python-checkins mailing list