cffbaa
# HG changeset patch
cffbaa
# User Mathias De Mare <mathias.de_mare@nokia.com>
cffbaa
# Date 1657634393 -7200
cffbaa
#      Tue Jul 12 15:59:53 2022 +0200
cffbaa
# Node ID eec5e00e782d83228f3f97f88f4bcf3d10b2ea1b
cffbaa
# Parent  259df3e3152c1fbb4d95c2fab682ca93581cf9ca
cffbaa
# EXP-Topic ssl-fix-python36-compat
cffbaa
sslutil: use proper attribute to select python 3.7+
cffbaa
cffbaa
The previous attribute was python 3.6+, but guarded a python 3.7+ block.
cffbaa
cffbaa
Using the correct attribute avoids:
cffbaa
  File "/usr/lib64/python3.6/site-packages/mercurial/sslutil.py", line 334, in wrapsocket
cffbaa
    sslcontext.minimum_version = ssl.TLSVersion.TLSv1_1
cffbaa
AttributeError: module 'ssl' has no attribute 'TLSVersion'
cffbaa
cffbaa
diff --git a/mercurial/sslutil.py b/mercurial/sslutil.py
cffbaa
--- a/mercurial/sslutil.py
cffbaa
+++ b/mercurial/sslutil.py
cffbaa
@@ -312,7 +312,7 @@
cffbaa
     # is loaded and contains that removed CA, you've just undone the user's
cffbaa
     # choice.
cffbaa
 
cffbaa
-    if util.safehasattr(ssl, 'PROTOCOL_TLS_CLIENT'):
cffbaa
+    if util.safehasattr(ssl, 'TLSVersion'):
cffbaa
         # python 3.7+
cffbaa
         sslcontext = ssl.SSLContext(ssl.PROTOCOL_TLS_CLIENT)
cffbaa
         minimumprotocol = settings[b'minimumprotocol']