Mercurial > public > mercurial-scm > hg-stable
comparison mercurial/sslutil.py @ 49384:4a1f0bc0713e stable
sslutil: another 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 "/tmp/hgtests.bc0_uk2d/install/lib/python/mercurial/sslutil.py", line 577, in wrapserversocket
+ sslcontext.minimum_version = ssl.TLSVersion.TLSv1_1
+ AttributeError: module 'ssl' has no attribute 'TLSVersion'
author | Ondrej Pohorelsky <opohorel@redhat.com> |
---|---|
date | Wed, 13 Jul 2022 18:27:40 +0200 |
parents | be3828081624 |
children | 698ffff7024b |
comparison
equal
deleted
inserted
replaced
49383:be3828081624 | 49384:4a1f0bc0713e |
---|---|
544 if f and not os.path.exists(f): | 544 if f and not os.path.exists(f): |
545 raise error.Abort( | 545 raise error.Abort( |
546 _(b'referenced certificate file (%s) does not exist') % f | 546 _(b'referenced certificate file (%s) does not exist') % f |
547 ) | 547 ) |
548 | 548 |
549 if util.safehasattr(ssl, 'PROTOCOL_TLS_SERVER'): | 549 if util.safehasattr(ssl, 'TLSVersion'): |
550 # python 3.7+ | 550 # python 3.7+ |
551 sslcontext = ssl.SSLContext(ssl.PROTOCOL_TLS_SERVER) | 551 sslcontext = ssl.SSLContext(ssl.PROTOCOL_TLS_SERVER) |
552 sslcontext.options |= getattr(ssl, 'OP_NO_COMPRESSION', 0) | 552 sslcontext.options |= getattr(ssl, 'OP_NO_COMPRESSION', 0) |
553 | 553 |
554 # This config option is intended for use in tests only. It is a giant | 554 # This config option is intended for use in tests only. It is a giant |