comparison mercurial/sslutil.py @ 49387:be3828081624 stable

sslutil: use proper attribute to select python 3.7+ The previous attribute was python 3.6+, but guarded a python 3.7+ block. Using the correct attribute avoids: File "/usr/lib64/python3.6/site-packages/mercurial/sslutil.py", line 334, in wrapsocket sslcontext.minimum_version = ssl.TLSVersion.TLSv1_1 AttributeError: module 'ssl' has no attribute 'TLSVersion'
author Mathias De Mare <mathias.de_mare@nokia.com>
date Tue, 12 Jul 2022 15:59:53 +0200
parents 27ef2aa953dd
children de2e158c380a
comparison
equal deleted inserted replaced
49386:1e12ea7d8435 49387:be3828081624
310 # CAs may undermine the user's intent. For example, a user may define a CA 310 # CAs may undermine the user's intent. For example, a user may define a CA
311 # bundle with a specific CA cert removed. If the system/default CA bundle 311 # bundle with a specific CA cert removed. If the system/default CA bundle
312 # is loaded and contains that removed CA, you've just undone the user's 312 # is loaded and contains that removed CA, you've just undone the user's
313 # choice. 313 # choice.
314 314
315 if util.safehasattr(ssl, 'PROTOCOL_TLS_CLIENT'): 315 if util.safehasattr(ssl, 'TLSVersion'):
316 # python 3.7+ 316 # python 3.7+
317 sslcontext = ssl.SSLContext(ssl.PROTOCOL_TLS_CLIENT) 317 sslcontext = ssl.SSLContext(ssl.PROTOCOL_TLS_CLIENT)
318 minimumprotocol = settings[b'minimumprotocol'] 318 minimumprotocol = settings[b'minimumprotocol']
319 if minimumprotocol == b'tls1.0': 319 if minimumprotocol == b'tls1.0':
320 with warnings.catch_warnings(): 320 with warnings.catch_warnings():