Skip to content

Commit 34992cf

Browse files
committed
bpo-38275: Fix for GH-16386
Check presence of SSLContext.minimum_version to make tests pass with old versions of OpenSSL. Signed-off-by: Christian Heimes <christian@python.org>
1 parent df6ac7e commit 34992cf

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

Lib/test/test_ssl.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -190,11 +190,13 @@ def has_tls_version(version):
190190
# be compiled in but disabled by a policy or config option.
191191
ctx = ssl.SSLContext()
192192
if (
193+
hasattr(ctx, 'minimum_version') and
193194
ctx.minimum_version != ssl.TLSVersion.MINIMUM_SUPPORTED and
194195
version < ctx.minimum_version
195196
):
196197
return False
197198
if (
199+
hasattr(ctx, 'maximum_version') and
198200
ctx.maximum_version != ssl.TLSVersion.MAXIMUM_SUPPORTED and
199201
version > ctx.maximum_version
200202
):

0 commit comments

Comments
 (0)