Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 7fa6e1a

Browse files
committed
Keep asyncio working with Python 3.3 too.
1 parent 085869b commit 7fa6e1a

1 file changed

Lines changed: 9 additions & 2 deletions

File tree

Lib/asyncio/selector_events.py

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -571,8 +571,15 @@ def __init__(self, loop, rawsock, protocol, sslcontext, waiter=None,
571571
# context; in that case the sslcontext passed is None.
572572
# The default is the same as used by urllib with
573573
# cadefault=True.
574-
sslcontext = ssl._create_stdlib_context(
575-
cert_reqs=ssl.CERT_REQUIRED)
574+
if hasattr(ssl, '_create_stdlib_context'):
575+
sslcontext = ssl._create_stdlib_context(
576+
cert_reqs=ssl.CERT_REQUIRED)
577+
else:
578+
# Fallback for Python 3.3.
579+
sslcontext = ssl.SSLContext(ssl.PROTOCOL_SSLv23)
580+
sslcontext.options |= ssl.OP_NO_SSLv2
581+
sslcontext.set_default_verify_paths()
582+
sslcontext.verify_mode = ssl.CERT_REQUIRED
576583

577584
wrap_kwargs = {
578585
'server_side': server_side,

0 commit comments

Comments
 (0)