Blob Blame History Raw
# HG changeset patch
# User Mathias De Mare <mathias.de_mare@nokia.com>
# Date 1657634393 -7200
#      Tue Jul 12 15:59:53 2022 +0200
# Node ID eec5e00e782d83228f3f97f88f4bcf3d10b2ea1b
# Parent  259df3e3152c1fbb4d95c2fab682ca93581cf9ca
# EXP-Topic ssl-fix-python36-compat
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'

diff --git a/mercurial/sslutil.py b/mercurial/sslutil.py
--- a/mercurial/sslutil.py
+++ b/mercurial/sslutil.py
@@ -312,7 +312,7 @@
     # is loaded and contains that removed CA, you've just undone the user's
     # choice.
 
-    if util.safehasattr(ssl, 'PROTOCOL_TLS_CLIENT'):
+    if util.safehasattr(ssl, 'TLSVersion'):
         # python 3.7+
         sslcontext = ssl.SSLContext(ssl.PROTOCOL_TLS_CLIENT)
         minimumprotocol = settings[b'minimumprotocol']