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

login
register
mail settings
Submitter Gregory Szorc
Date July 4, 2016, 5:04 p.m.
Message ID <4254ad0849ba9b819114.1467651879@ubuntu-vm-main>
Download mbox | patch
Permalink /patch/15740/
State Accepted
Headers show

Comments

Gregory Szorc - July 4, 2016, 5:04 p.m.
# HG changeset patch
# User Gregory Szorc <gregory.szorc@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.

Patch

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: