changeset: 101913:d84268ed62ac branch: 3.5 parent: 101909:a7e04b4e51b2 user: Martin Panter date: Sun Jun 12 04:24:06 2016 +0000 files: Lib/pydoc.py Lib/test/test_pydoc.py Misc/NEWS description: Issue #16484: Fix pydoc link and test on Windows, by Kaushik Nadikuditi diff -r a7e04b4e51b2 -r d84268ed62ac Lib/pydoc.py --- a/Lib/pydoc.py Sun Jun 12 01:46:50 2016 +0000 +++ b/Lib/pydoc.py Sun Jun 12 04:24:06 2016 +0000 @@ -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 @@ -395,6 +395,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', @@ -402,7 +403,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 -r a7e04b4e51b2 -r d84268ed62ac Lib/test/test_pydoc.py --- a/Lib/test/test_pydoc.py Sun Jun 12 01:46:50 2016 +0000 +++ b/Lib/test/test_pydoc.py Sun Jun 12 04:24:06 2016 +0000 @@ -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 -r a7e04b4e51b2 -r d84268ed62ac Misc/NEWS --- a/Misc/NEWS Sun Jun 12 01:46:50 2016 +0000 +++ b/Misc/NEWS Sun Jun 12 04:24:06 2016 +0000 @@ -591,6 +591,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 #26736: Used HTTPS for external links in the documentation if possible.