Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 61289d4

Browse filesBrowse files
python273taleinat
authored andcommitted
bpo-38786: Add parsing of https links to pydoc (GH-17143)
1 parent d89cea1 commit 61289d4
Copy full SHA for 61289d4

4 files changed

+14-2Lines changed: 14 additions & 2 deletions

File tree

Expand file treeCollapse file tree
Open diff view settings
Filter options
Expand file treeCollapse file tree
Open diff view settings
Collapse file

‎Lib/pydoc.py‎

Copy file name to clipboardExpand all lines: Lib/pydoc.py
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -585,7 +585,7 @@ def markup(self, text, escape=None, funcs={}, classes={}, methods={}):
585585
escape = escape or self.escape
586586
results = []
587587
here = 0
588-
pattern = re.compile(r'\b((http|ftp)://\S+[\w/]|'
588+
pattern = re.compile(r'\b((http|https|ftp)://\S+[\w/]|'
589589
r'RFC[- ]?(\d+)|'
590590
r'PEP[- ]?(\d+)|'
591591
r'(self\.)?(\w+))')
Collapse file

‎Lib/test/test_pydoc.py‎

Copy file name to clipboardExpand all lines: Lib/test/test_pydoc.py
+11Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1311,6 +1311,17 @@ async def an_async_generator():
13111311
'async <a name="-an_async_generator"><strong>an_async_generator',
13121312
html)
13131313

1314+
def test_html_for_https_links(self):
1315+
def a_fn_with_https_link():
1316+
"""a link https://localhost/"""
1317+
pass
1318+
1319+
html = pydoc.HTMLDoc().document(a_fn_with_https_link)
1320+
self.assertIn(
1321+
'<a href="https://localhost/">https://localhost/</a>',
1322+
html
1323+
)
1324+
13141325
class PydocServerTest(unittest.TestCase):
13151326
"""Tests for pydoc._start_server"""
13161327

Collapse file

‎Lib/xmlrpc/server.py‎

Copy file name to clipboardExpand all lines: Lib/xmlrpc/server.py
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -732,7 +732,7 @@ def markup(self, text, escape=None, funcs={}, classes={}, methods={}):
732732
# hyperlinking of arbitrary strings being used as method
733733
# names. Only methods with names consisting of word characters
734734
# and '.'s are hyperlinked.
735-
pattern = re.compile(r'\b((http|ftp)://\S+[\w/]|'
735+
pattern = re.compile(r'\b((http|https|ftp)://\S+[\w/]|'
736736
r'RFC[- ]?(\d+)|'
737737
r'PEP[- ]?(\d+)|'
738738
r'(self\.)?((?:\w|\.)+))\b')
Collapse file
+1Lines changed: 1 addition & 0 deletions
  • Display the source diff
  • Display the rich diff
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
pydoc now recognizes and parses HTTPS URLs. Patch by python273.

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.