Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 4f8aaf6

Browse files
committed
Issue #16484: Fix pydoc link and test on Windows, by Kaushik Nadikuditi
1 parent 0c0da48 commit 4f8aaf6

3 files changed

Lines changed: 8 additions & 3 deletions

File tree

Lib/pydoc.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ class or function within a module or module in a package. If the
2828
2929
Module docs for core modules are assumed to be in
3030
31-
http://docs.python.org/X.Y/library/
31+
https://docs.python.org/X.Y/library/
3232
3333
This can be overridden by setting the PYTHONDOCS environment variable
3434
to a different URL or to a local directory containing the Library
@@ -395,14 +395,15 @@ def getdocloc(self, object,
395395

396396
docloc = os.environ.get("PYTHONDOCS", self.PYTHONDOCS)
397397

398+
basedir = os.path.normcase(basedir)
398399
if (isinstance(object, type(os)) and
399400
(object.__name__ in ('errno', 'exceptions', 'gc', 'imp',
400401
'marshal', 'posix', 'signal', 'sys',
401402
'_thread', 'zipimport') or
402403
(file.startswith(basedir) and
403404
not file.startswith(os.path.join(basedir, 'site-packages')))) and
404405
object.__name__ not in ('xml.etree', 'test.pydoc_mod')):
405-
if docloc.startswith("http://"):
406+
if docloc.startswith(("http://", "https://")):
406407
docloc = "%s/%s" % (docloc.rstrip("/"), object.__name__.lower())
407408
else:
408409
docloc = os.path.join(docloc, object.__name__.lower() + ".html")

Lib/test/test_pydoc.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -356,7 +356,7 @@ def get_pydoc_html(module):
356356
def get_pydoc_link(module):
357357
"Returns a documentation web link of a module"
358358
dirname = os.path.dirname
359-
basedir = os.path.join(dirname(dirname(__file__)))
359+
basedir = dirname(dirname(__file__))
360360
doc = pydoc.TextDoc()
361361
loc = doc.getdocloc(module, basedir=basedir)
362362
return loc

Misc/NEWS

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -591,6 +591,10 @@ IDLE
591591
Documentation
592592
-------------
593593

594+
- Issue #16484: Change the default PYTHONDOCS URL to "https:", and fix the
595+
resulting links to use lowercase. Patch by Sean Rodman, test by Kaushik
596+
Nadikuditi.
597+
594598
- Issue #24136: Document the new PEP 448 unpacking syntax of 3.5.
595599

596600
- Issue #26736: Used HTTPS for external links in the documentation if possible.

0 commit comments

Comments
 (0)