]> granicus.if.org Git - python/commitdiff
bpo-38275: Fix test_ssl issue caused by GH-16386 (#16428)
authorChristian Heimes <christian@python.org>
Thu, 26 Sep 2019 16:23:17 +0000 (18:23 +0200)
committerGitHub <noreply@github.com>
Thu, 26 Sep 2019 16:23:17 +0000 (18:23 +0200)
Check presence of SSLContext.minimum_version to make tests pass with
old versions of OpenSSL.

Signed-off-by: Christian Heimes <christian@python.org>
Lib/test/test_ssl.py

index 8bb74b438895002c59879801a17689a61ede8500..3cd6e927a469e097d49097d435280988fdea3faf 100644 (file)
@@ -190,11 +190,13 @@ def has_tls_version(version):
     # be compiled in but disabled by a policy or config option.
     ctx = ssl.SSLContext()
     if (
+            hasattr(ctx, 'minimum_version') and
             ctx.minimum_version != ssl.TLSVersion.MINIMUM_SUPPORTED and
             version < ctx.minimum_version
     ):
         return False
     if (
+        hasattr(ctx, 'maximum_version') and
         ctx.maximum_version != ssl.TLSVersion.MAXIMUM_SUPPORTED and
         version > ctx.maximum_version
     ):