[PATCH 7 of 8] sslutil: expand _defaultcacerts docstring to note calling assumptions

Gregory Szorc gregory.szorc at gmail.com
Fri Jul 1 22:57:43 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 d3ae9cd26627123efd30a2e71d87eebf05b6f63c
# Parent  17d67895b215c5c977d2b446611abb219160a6f9
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
@@ -427,17 +427,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.
     with demandimport.deactivated():
         try:
             import certifi
             ui.debug('using ca certificates from certifi\n')
             return certifi.where()
         except Exception:


More information about the Mercurial-devel mailing list