summaryrefslogtreecommitdiffstats
path: root/Lib
diff options
context:
space:
mode:
authorMartin Panter <vadmium+py@gmail.com>2016-06-12 04:24:06 (GMT)
committerMartin Panter <vadmium+py@gmail.com>2016-06-12 04:24:06 (GMT)
commit4f8aaf644095fef61ba1104af0f07efe2a099079 (patch)
treedbea7fc8da42dc9d5310fdb1aeba540dd8be868c /Lib
parent0c0da48aede7e56f722fd8240bf7c27a862bc4d3 (diff)
downloadcpython-4f8aaf644095fef61ba1104af0f07efe2a099079.zip
cpython-4f8aaf644095fef61ba1104af0f07efe2a099079.tar.gz
cpython-4f8aaf644095fef61ba1104af0f07efe2a099079.tar.bz2
Issue #16484: Fix pydoc link and test on Windows, by Kaushik Nadikuditi
Diffstat (limited to 'Lib')
-rwxr-xr-xLib/pydoc.py5
-rw-r--r--Lib/test/test_pydoc.py2
2 files changed, 4 insertions, 3 deletions
diff --git a/Lib/pydoc.py b/Lib/pydoc.py
index 3ca08c9..0d0d0ab 100755
--- a/Lib/pydoc.py
+++ b/Lib/pydoc.py
@@ -28,7 +28,7 @@ to a file named "<name>.html".
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 @@ class Doc:
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 @@ class Doc:
(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
index 59aa715..aee979b 100644
--- a/Lib/test/test_pydoc.py
+++ b/Lib/test/test_pydoc.py
@@ -356,7 +356,7 @@ def get_pydoc_html(module):
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