Patchwork [01,of,15] sslutil: set `_canloaddefaultcerts` to `True` if `ssl.SSLContext` is present

login
register
mail settings
Submitter Manuel Jacob
Date May 30, 2020, 5:52 a.m.
Message ID <45c87d05a2ba00d32181.1590817933@tmp>
Download mbox | patch
Permalink /patch/46396/
State New
Headers show

Comments

Manuel Jacob - May 30, 2020, 5:52 a.m.
# HG changeset patch
# User Manuel Jacob <me@manueljacob.de>
# Date 1590803219 -7200
#      Sat May 30 03:46:59 2020 +0200
# Node ID 45c87d05a2ba00d32181c94bf56d52f48f9c9f02
# Parent  3aed7d262bdfd08e8a5d356c8f5a90251bfc70b5
# EXP-Topic require_modern_ssl
sslutil: set `_canloaddefaultcerts` to `True` if `ssl.SSLContext` is present

The `load_default_certs()` method was already present when `ssl.SSLContext`
was backported to Python 2.7 (https://hg.python.org/cpython/rev/221a1f9155e2).

Patch

diff --git a/mercurial/sslutil.py b/mercurial/sslutil.py
--- a/mercurial/sslutil.py
+++ b/mercurial/sslutil.py
@@ -58,7 +58,7 @@  try:
     # SSL/TLS features are available.
     SSLContext = ssl.SSLContext
     modernssl = True
-    _canloaddefaultcerts = util.safehasattr(SSLContext, b'load_default_certs')
+    _canloaddefaultcerts = True
 except AttributeError:
     modernssl = False
     _canloaddefaultcerts = False