mirror of
https://github.com/python/cpython.git
synced 2024-11-28 12:31:14 +08:00
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@python.org>
This commit is contained in:
parent
df6ac7e2b8
commit
9f77268f90
@ -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
|
||||
):
|
||||
|
Loading…
Reference in New Issue
Block a user