diff --git a/Lib/pydoc.py b/Lib/pydoc.py
--- a/Lib/pydoc.py
+++ b/Lib/pydoc.py
@@ -366,7 +366,7 @@
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):
@@ -415,9 +415,9 @@
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
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
@@ -18,6 +18,7 @@
import unittest
import urllib.parse
import xml.etree
+import xml.etree.ElementTree
import textwrap
from io import StringIO
from collections import namedtuple
@@ -352,6 +353,12 @@
loc = "
Module Docs"
return output.strip(), loc
+def get_pydoc_link(module):
+ " Returns doc link of a module "
+ doc = pydoc.TextDoc()
+ loc = doc.getdocloc(module) or ""
+ return loc
+
def get_pydoc_text(module):
"Returns pydoc generated output as text"
doc = pydoc.TextDoc()
@@ -443,6 +450,13 @@
doc = pydoc.render_doc(BinaryInteger)
self.assertIn('', doc)
+ def test_issue16484(self):
+ # Test issue16484 to ensure class names are lowered in doc link.
+ doc_link = get_pydoc_link(xml.etree.ElementTree)
+ expected_link = 'https://docs.python.org/%d.%d/library/' \
+ 'xml.etree.elementtree.html' % sys.version_info[:2]
+ self.assertEqual(doc_link, expected_link)
+
def test_issue8225(self):
# Test issue8225 to ensure no doc link appears for xml.etree
result, doc_loc = get_pydoc_text(xml.etree)