[Python-checkins] bpo-38275: Fix test_ssl issue caused by GH-16386 (#16428)

Christian Heimes webhook-mailer at python.org
Thu Sep 26 12:23:33 EDT 2019


https://github.com/python/cpython/commit/9f77268f901cc3e8874e5042361520a0e482476a
commit: 9f77268f901cc3e8874e5042361520a0e482476a
branch: master
author: Christian Heimes <christian at python.org>
committer: GitHub <noreply at github.com>
date: 2019-09-26T18:23:17+02:00
summary:

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: Christian Heimes <christian at python.org>

files:
M Lib/test/test_ssl.py

diff --git a/Lib/test/test_ssl.py b/Lib/test/test_ssl.py
index 8bb74b438895..3cd6e927a469 100644
--- a/Lib/test/test_ssl.py
+++ b/Lib/test/test_ssl.py
@@ -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
     ):



More information about the Python-checkins mailing list