diff options
author | R David Murray <rdmurray@bitdance.com> | 2016-06-03 23:28:35 (GMT) |
---|---|---|
committer | R David Murray <rdmurray@bitdance.com> | 2016-06-03 23:28:35 (GMT) |
commit | ead9bfc5c392951d8f0d8c537a138df672b762e4 (patch) | |
tree | 8abe2fd240e810f6c9adbacbd78ed8910c9d21b9 /Lib/pydoc.py | |
parent | 369826a879386a6de7e493e5b789fd8a5b5fa5be (diff) | |
download | cpython-ead9bfc5c392951d8f0d8c537a138df672b762e4.zip cpython-ead9bfc5c392951d8f0d8c537a138df672b762e4.tar.gz cpython-ead9bfc5c392951d8f0d8c537a138df672b762e4.tar.bz2 |
#16484: Fix pydoc doc links to modules whose names are mixed case.
Patch by Sean Rodman, test by Kaushik N.
Diffstat (limited to 'Lib/pydoc.py')
-rwxr-xr-x | Lib/pydoc.py | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/Lib/pydoc.py b/Lib/pydoc.py index a9c04f0..3ca08c9 100755 --- a/Lib/pydoc.py +++ b/Lib/pydoc.py @@ -354,7 +354,7 @@ def safeimport(path, forceload=0, cache={}): class Doc: PYTHONDOCS = os.environ.get("PYTHONDOCS", - "http://docs.python.org/%d.%d/library" + "https://docs.python.org/%d.%d/library" % sys.version_info[:2]) def document(self, object, name=None, *args): @@ -383,7 +383,9 @@ class Doc: docmodule = docclass = docroutine = docother = docproperty = docdata = fail - def getdocloc(self, object): + def getdocloc(self, object, + basedir=os.path.join(sys.base_exec_prefix, "lib", + "python%d.%d" % sys.version_info[:2])): """Return the location of module docs or None""" try: @@ -393,8 +395,6 @@ class Doc: docloc = os.environ.get("PYTHONDOCS", self.PYTHONDOCS) - basedir = os.path.join(sys.base_exec_prefix, "lib", - "python%d.%d" % sys.version_info[:2]) if (isinstance(object, type(os)) and (object.__name__ in ('errno', 'exceptions', 'gc', 'imp', 'marshal', 'posix', 'signal', 'sys', @@ -403,9 +403,9 @@ class Doc: not file.startswith(os.path.join(basedir, 'site-packages')))) and object.__name__ not in ('xml.etree', 'test.pydoc_mod')): if docloc.startswith("http://"): - docloc = "%s/%s" % (docloc.rstrip("/"), object.__name__) + docloc = "%s/%s" % (docloc.rstrip("/"), object.__name__.lower()) else: - docloc = os.path.join(docloc, object.__name__ + ".html") + docloc = os.path.join(docloc, object.__name__.lower() + ".html") else: docloc = None return docloc |