[PATCH 3 of 4 V2] sslutil: expand _defaultcacerts docstring to note calling assumptions

Gregory Szorc gregory.szorc at gmail.com
Mon Jul 4 13:04:39 EDT 2016


# HG changeset patch
# User Gregory Szorc <gregory.szorc at gmail.com>
# Date 1467341652 25200
#      Thu Jun 30 19:54:12 2016 -0700
# Node ID 4254ad0849ba9b8191147f485afdcd93d8a935a5
# Parent  5502ac4d0b7380e1f666a3a5a6cc5f4319c4ed73
sslutil: expand _defaultcacerts docstring to note calling assumptions

We should document this so future message additions don't seem out
of place.

diff --git a/mercurial/sslutil.py b/mercurial/sslutil.py
--- a/mercurial/sslutil.py
+++ b/mercurial/sslutil.py
@@ -426,17 +426,22 @@ def _plainapplepython():
     """
     if sys.platform != 'darwin' or util.mainfrozen() or not sys.executable:
         return False
     exe = os.path.realpath(sys.executable).lower()
     return (exe.startswith('/usr/bin/python') or
             exe.startswith('/system/library/frameworks/python.framework/'))
 
 def _defaultcacerts(ui):
-    """return path to default CA certificates or None."""
+    """return path to default CA certificates or None.
+
+    It is assumed this function is called when the returned certificates
+    file will actually be used to validate connections. Therefore this
+    function may print warnings or debug messages assuming this usage.
+    """
     # The "certifi" Python package provides certificates. If it is installed,
     # assume the user intends it to be used and use it.
     try:
         import certifi
         certs = certifi.where()
         ui.debug('using ca certificates from certifi\n')
         return certs
     except ImportError:


More information about the Mercurial-devel mailing list