Skip to content

Commit 9f77268

Browse files
authored
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 <[email protected]>
1 parent df6ac7e commit 9f77268

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

Lib/test/test_ssl.py

+2
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)