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

login
register
mail settings
Submitter Gregory Szorc
Date July 2, 2016, 2:57 a.m.
Message ID <d3ae9cd26627123efd30.1467428263@ubuntu-vm-main>
Download mbox | patch
Permalink /patch/15722/
State Superseded
Delegated to: Yuya Nishihara
Headers show

Comments

Gregory Szorc - July 2, 2016, 2:57 a.m.
# HG changeset patch
# User Gregory Szorc <gregory.szorc@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.

Patch

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: