Commit 9f77268f authored by Christian Heimes's avatar Christian Heimes Committed by GitHub

bpo-38275: Fix test_ssl issue caused by GH-16386 (#16428)

Check presence of SSLContext.minimum_version to make tests pass with
old versions of OpenSSL.
Signed-off-by: default avatarChristian Heimes <christian@python.org>
parent df6ac7e2
...@@ -190,11 +190,13 @@ def has_tls_version(version): ...@@ -190,11 +190,13 @@ def has_tls_version(version):
# be compiled in but disabled by a policy or config option. # be compiled in but disabled by a policy or config option.
ctx = ssl.SSLContext() ctx = ssl.SSLContext()
if ( if (
hasattr(ctx, 'minimum_version') and
ctx.minimum_version != ssl.TLSVersion.MINIMUM_SUPPORTED and ctx.minimum_version != ssl.TLSVersion.MINIMUM_SUPPORTED and
version < ctx.minimum_version version < ctx.minimum_version
): ):
return False return False
if ( if (
hasattr(ctx, 'maximum_version') and
ctx.maximum_version != ssl.TLSVersion.MAXIMUM_SUPPORTED and ctx.maximum_version != ssl.TLSVersion.MAXIMUM_SUPPORTED and
version > ctx.maximum_version version > ctx.maximum_version
): ):
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment