19b070
# HG changeset patch
19b070
# User Ondrej Pohorelsky <opohorel@redhat.com>
19b070
# Date 1657729660 -7200
19b070
#      Wed Jul 13 18:27:40 2022 +0200
19b070
# Node ID 5f95d1ae2fcefd1d6b81cbba9355198fc6bc073f
19b070
# Parent  259df3e3152c1fbb4d95c2fab682ca93581cf9ca
19b070
# EXP-Topic ssl-another-fix-python36-compat
19b070
sslutil: another 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 "/tmp/hgtests.bc0_uk2d/install/lib/python/mercurial/sslutil.py", line 577, in wrapserversocket
19b070
+      sslcontext.minimum_version = ssl.TLSVersion.TLSv1_1
19b070
+  AttributeError: module 'ssl' has no attribute 'TLSVersion'
19b070
19b070
diff -r 259df3e3152c -r 5f95d1ae2fce mercurial/sslutil.py
19b070
--- a/mercurial/sslutil.py	Mon Jul 11 09:54:40 2022 +0200
19b070
+++ b/mercurial/sslutil.py	Wed Jul 13 18:27:40 2022 +0200
19b070
@@ -546,7 +546,7 @@
19b070
                 _(b'referenced certificate file (%s) does not exist') % f
19b070
             )
19b070
 
19b070
-    if util.safehasattr(ssl, 'PROTOCOL_TLS_SERVER'):
19b070
+    if util.safehasattr(ssl, 'TLSVersion'):
19b070
         # python 3.7+
19b070
         sslcontext = ssl.SSLContext(ssl.PROTOCOL_TLS_SERVER)
19b070
         sslcontext.options |= getattr(ssl, 'OP_NO_COMPRESSION', 0)