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