[Python-checkins] cpython (merge 3.5 -> default): Issue #16484: Merge pydoc Windows fixes from 3.5

martin.panter python-checkins at python.org
Sun Jun 12 00:38:19 EDT 2016


https://hg.python.org/cpython/rev/84d1e5a4b1c5
changeset:   101914:84d1e5a4b1c5
parent:      101912:0146e422f0b3
parent:      101913:d84268ed62ac
user:        Martin Panter <vadmium+py at gmail.com>
date:        Sun Jun 12 04:31:25 2016 +0000
summary:
  Issue #16484: Merge pydoc Windows fixes from 3.5

files:
  Lib/pydoc.py           |  5 +++--
  Lib/test/test_pydoc.py |  2 +-
  Misc/NEWS              |  4 ++++
  3 files changed, 8 insertions(+), 3 deletions(-)


diff --git a/Lib/pydoc.py b/Lib/pydoc.py
--- a/Lib/pydoc.py
+++ b/Lib/pydoc.py
@@ -28,7 +28,7 @@
 
 Module docs for core modules are assumed to be in
 
-    http://docs.python.org/X.Y/library/
+    https://docs.python.org/X.Y/library/
 
 This can be overridden by setting the PYTHONDOCS environment variable
 to a different URL or to a local directory containing the Library
@@ -407,6 +407,7 @@
 
         docloc = os.environ.get("PYTHONDOCS", self.PYTHONDOCS)
 
+        basedir = os.path.normcase(basedir)
         if (isinstance(object, type(os)) and
             (object.__name__ in ('errno', 'exceptions', 'gc', 'imp',
                                  'marshal', 'posix', 'signal', 'sys',
@@ -414,7 +415,7 @@
              (file.startswith(basedir) and
               not file.startswith(os.path.join(basedir, 'site-packages')))) and
             object.__name__ not in ('xml.etree', 'test.pydoc_mod')):
-            if docloc.startswith("http://"):
+            if docloc.startswith(("http://", "https://")):
                 docloc = "%s/%s" % (docloc.rstrip("/"), object.__name__.lower())
             else:
                 docloc = os.path.join(docloc, object.__name__.lower() + ".html")
diff --git a/Lib/test/test_pydoc.py b/Lib/test/test_pydoc.py
--- a/Lib/test/test_pydoc.py
+++ b/Lib/test/test_pydoc.py
@@ -356,7 +356,7 @@
 def get_pydoc_link(module):
     "Returns a documentation web link of a module"
     dirname = os.path.dirname
-    basedir = os.path.join(dirname(dirname(__file__)))
+    basedir = dirname(dirname(__file__))
     doc = pydoc.TextDoc()
     loc = doc.getdocloc(module, basedir=basedir)
     return loc
diff --git a/Misc/NEWS b/Misc/NEWS
--- a/Misc/NEWS
+++ b/Misc/NEWS
@@ -225,6 +225,10 @@
 Documentation
 -------------
 
+- Issue #16484: Change the default PYTHONDOCS URL to "https:", and fix the
+  resulting links to use lowercase.  Patch by Sean Rodman, test by Kaushik
+  Nadikuditi.
+
 - Issue #24136: Document the new PEP 448 unpacking syntax of 3.5.
 
 - Issue #22558: Add remaining doc links to source code for Python-coded modules.

-- 
Repository URL: https://hg.python.org/cpython


More information about the Python-checkins mailing list