Repository navigation
Closed
Labels
3.13only security fixesonly security fixes3.14bugs and security fixesbugs and security fixes3.15bugs and security fixesbugs and security fixesstdlibStandard Library Python modules in the Lib/ directoryStandard Library Python modules in the Lib/ directorytype-bugAn unexpected behavior, bug, or errorAn unexpected behavior, bug, or error
Description
| BPO | 40051 |
|---|---|
| Nosy | @smontanaro, @terryjreedy, @merwok, @bitdancer, @vadmium, @zware, @wyz23x2, @Joshuah143 |
| PRs |
Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.
Show more details
GitHub fields:
assignee = None
closed_at = None
created_at = <Date 2020-03-24.05:06:25.977>
labels = ['type-bug', 'library', '3.11']
title = 'Give proper link in help(idlelib/turtledemo/tkinter.sub/test_*/?)'
updated_at = <Date 2021-11-08.03:08:11.097>
user = 'https://github.com/wyz23x2'bugs.python.org fields:
activity = <Date 2021-11-08.03:08:11.097>
actor = 'eric.araujo'
assignee = 'docs@python'
closed = False
closed_date = None
closer = None
components = ['Library (Lib)']
creation = <Date 2020-03-24.05:06:25.977>
creator = 'wyz23x2'
dependencies = []
files = []
hgrepos = []
issue_num = 40051
keywords = ['patch']
message_count = 15.0
messages = ['364917', '365232', '365246', '368021', '368044', '368102', '374998', '404542', '404545', '404825', '405765', '405767', '405768', '405922', '405923']
nosy_count = 9.0
nosy_names = ['skip.montanaro', 'terry.reedy', 'eric.araujo', 'r.david.murray', 'docs@python', 'martin.panter', 'zach.ware', 'wyz23x2', 'Joshuah143']
pr_nums = ['29419', '29459']
priority = 'normal'
resolution = None
stage = 'test needed'
status = 'open'
superseder = None
type = 'behavior'
url = 'https://bugs.python.org/issue40051'
versions = ['Python 3.11']Linked PRs
Metadata
Metadata
Assignees
Labels
3.13only security fixesonly security fixes3.14bugs and security fixesbugs and security fixes3.15bugs and security fixesbugs and security fixesstdlibStandard Library Python modules in the Lib/ directoryStandard Library Python modules in the Lib/ directorytype-bugAn unexpected behavior, bug, or errorAn unexpected behavior, bug, or error
Projects
- StatusShow more project fieldsDone
Activity
wyz23x2 commentedon Mar 24, 2020
The output contains this link:
--snip--
MODULE REFERENCE
https://docs.python.org/3.8/library/lib2to3 <--
--snip--
But when you access it, 404!
This works:
https://docs.python.org/3.8/library/2to3.html#module-lib2to3
Please change it. Thanks!
terryjreedy commentedon Mar 28, 2020
Lib/lib2to3 is a directory with __init__.py containing
### empty
Unlike most python-coded modules, there is no Doc/library/lib2to3.rst and hence no generated lib2to3.html. Instead, there is a 2to3.rst and 2to3.html. In the module index, module xyz is usually linked to .../library/xyz.html#module-xyz. But lib2to3 is somewhere linked instead to .../library/2to3.html#module-lib2to3.
As implied by the changed title, this issue is not at all unique to lib2to3. Just as lib2to3 implements the command line app 2to3, with 2to3.rst, idlelib implements IDLE with idle.rst. Turtle demo is domumented within turtle.rst. Most tkinter submodule have no doc other than a mention within tkinter.rst. These could perhaps have a # module-tkinter.xyz target added. (I am not familiar with exactly how.) But there are also the numerous test modules that have no doc, and the generated doc for these is less useful than the code itself.
Possible solutions framed in terms of lib2to3:
Manual redirection: add lib2to3.rst and hence lib2to3.html with the correct url, possibly with additional text. But this is not the only module documented within a file with another name, and would not work for things like test files that should not be documented.
Auto redirection: persuade whoever manages docs.python.org to add
a redirection for lib2to3. Fragile.
Hardcode the exception in the help output generation. The latter is generated by pydoc.help. The module doc location under MODULE REFERENCE is generated by pydoc.Doc.getdocloc. This function already has a couple of (probably obsolete) tuples of exceptions, so adding more seems OK.
The oddity is that .html is added if and only if the doc location does not start with 'http'. lines 414-417.I think that this is backwards. It only works because docs.python.org adds missing .html, even to "https://docs.python.org/3.8/library/2to3#module-lib2to3", which is why the bug? has not been noticed. Note that by default, docloc starts with 'https://', so by default, .html is omitted.
Skip, David, and Martin, you have all modified this part of the code. Do any of you disagree that there is a bug?
56 remaining items
gh-84232: Fix `pydoc` docs.python.org link generation (#139995)
merwok commentedon Dec 23, 2025
@StanFromIreland @hugovk Shouldn’t this be backported to bugfix branches?
(On the PR, I said I didn’t add the backports labels because manual backports were needed, not because there shouldn’t be backports)
pythongh-84232: Fix `pydoc` docs.python.org link generation (pythonGH…
[3.13] pythongh-84232: Fix `pydoc` docs.python.org link generation (p…
[3.14] gh-84232: Fix `pydoc` docs.python.org link generation (GH-139995…
[3.13] gh-84232: Fix `pydoc` docs.python.org link generation (GH-139995…