You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Give proper link in help(idlelib/turtledemo/tkinter.sub/test_*/?) #84232
3.13only security fixes3.14bugs and security fixes3.15bugs and security fixesstdlibStandard Library Python modules in the Lib/ directorytype-bugAn unexpected behavior, bug, or error
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=Noneclosed_at=Nonecreated_at=<Date2020-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=<Date2021-11-08.03:08:11.097>user='https://github.com/wyz23x2'
My opinion:
I think No.2 makes more sense to users that visit the docs directly by https://docs.python.org/3.8/library/lib2to3.html; they will copy the "docs.python.org/version/library/modulename.html" format from other modules. But I also agree it's fragile.
No.3 is good too, according to me. Can use it if No.2 is too fragile.
changed the title [-]Dead link in help(lib2to3/idlelib/turtledemo/tkinter.sub/test_*/?)[/-][+]Dead link in help(idlelib/turtledemo/tkinter.sub/test_*/?)[/+]on Oct 20, 2021
changed the title [-]Dead link in help(lib2to3/idlelib/turtledemo/tkinter.sub/test_*/?)[/-][+]Dead link in help(idlelib/turtledemo/tkinter.sub/test_*/?)[/+]on Oct 20, 2021
As the title suggested, this is a generic help(module) issue that involves several library modules, including idlelib. It just happened to be reported for 2to3. For example, the generated text for
import idlelib; help(idlelib)
includes
MODULE REFERENCE https://docs.python.org/3.11/library/idlelib.html
It should be .../idle.html.
The holdup is that I was not then willing to unilaterally decide which of the 3 possible solutions I listed should be pursued. Maybe just 3, maybe a mix of 1 and 3.
changed the title [-]Dead link in help(idlelib/turtledemo/tkinter.sub/test_*/?)[/-][+]Give proper link in help(idlelib/turtledemo/tkinter.sub/test_*/?)[/+]on Oct 20, 2021
changed the title [-]Dead link in help(idlelib/turtledemo/tkinter.sub/test_*/?)[/-][+]Give proper link in help(idlelib/turtledemo/tkinter.sub/test_*/?)[/+]on Oct 20, 2021
Option 4: generate a list of modules (or a mapping of module names to documentation files) that have documentation when generating Lib/pydoc_data/topics.py, and teach pydoc.help to not include the link when it knows the module doesn't have documentation.
This is a much more complete solution that also avoids creating links for private modules (see bpo-45717), but is significantly more effort to implement.
Joshuah143 commented on Nov 5, 2021
Joshuah143mannequin
Mannequin
More actions
I think that option 4 would work best but instead of putting any logic in (Lib/pydoc_data/topics.py)[https://github.com/python/cpython/blob/main/Lib/pydoc_data/topics.py] we could put the logic for working with private modules as well and other edge cases in (Lib/pydoc.py)[https://github.com/python/cpython/blob/main/Lib/pydoc.py]. It might make future changes easier.
This actually turned out to be less effort than I expected (though I still should have been asleep 2 hours ago), so I've gone ahead and opened #29419 to implement what I suggested.
PR-29419 solves the issue in bpo-45717 of not giving a link for _* modules with no doc. It does not solve this issue of giving the proper link for module that need non-standard links, which typically need a '#' suffix, as in '.../library/2to3.html#module-lib2to3'. I suggest to continue calculating standard links as done now as the precalculation needs much space for a trivial time saving. Restrict the new dict to non-standard links. They can be calculated, with the needed suffixes, as they are now for the index. The link logic would be to try the lookup first and if module name does not start with '_', calculate the link.
I will add an idlelib section to idle.rst so that 'idlelib' appears in the module index and get entered into the exceptions dict.
I don't see how PR-29459 get linked here as it has no reference to this issue. So I will ignore it at least for know.
3.13only security fixes3.14bugs and security fixes3.15bugs and security fixesstdlibStandard Library Python modules in the Lib/ directorytype-bugAn unexpected behavior, bug, or error
Activity
[-]Dead link in help(lib2to3)[/-][+]Dead link in help(lib2to3/idlelib/turtledemo/tkinter.sub/test_*/?)[/+][-]Dead link in help(lib2to3)[/-][+]Dead link in help(lib2to3/idlelib/turtledemo/tkinter.sub/test_*/?)[/+]wyz23x2 commentedon Mar 29, 2020
My opinion:
I think No.2 makes more sense to users that visit the docs directly by https://docs.python.org/3.8/library/lib2to3.html; they will copy the "docs.python.org/version/library/modulename.html" format from other modules. But I also agree it's fragile.
No.3 is good too, according to me. Can use it if No.2 is too fragile.
wyz23x2 commentedon May 4, 2020
Patch?
terryjreedy commentedon May 4, 2020
Not until decision made. And not be me until I have my development machine running.
wyz23x2 commentedon May 5, 2020
OK.
wyz23x2 commentedon Aug 7, 2020
Ping? Which of the 3 should we choose?
zware commentedon Oct 20, 2021
This one got caught up in the purge of 2to3 issues, but it's about more than just 2to3. Reopening.
[-]Dead link in help(lib2to3/idlelib/turtledemo/tkinter.sub/test_*/?)[/-][+]Dead link in help(idlelib/turtledemo/tkinter.sub/test_*/?)[/+][-]Dead link in help(lib2to3/idlelib/turtledemo/tkinter.sub/test_*/?)[/-][+]Dead link in help(idlelib/turtledemo/tkinter.sub/test_*/?)[/+]terryjreedy commentedon Oct 20, 2021
As the title suggested, this is a generic help(module) issue that involves several library modules, including idlelib. It just happened to be reported for 2to3. For example, the generated text for
import idlelib; help(idlelib)
includes
MODULE REFERENCE
https://docs.python.org/3.11/library/idlelib.html
It should be .../idle.html.
The holdup is that I was not then willing to unilaterally decide which of the 3 possible solutions I listed should be pursued. Maybe just 3, maybe a mix of 1 and 3.
[-]Dead link in help(idlelib/turtledemo/tkinter.sub/test_*/?)[/-][+]Give proper link in help(idlelib/turtledemo/tkinter.sub/test_*/?)[/+][-]Dead link in help(idlelib/turtledemo/tkinter.sub/test_*/?)[/-][+]Give proper link in help(idlelib/turtledemo/tkinter.sub/test_*/?)[/+]merwok commentedon Oct 22, 2021
Option 3 seems simple and ok to me.
zware commentedon Nov 5, 2021
Option 4: generate a list of modules (or a mapping of module names to documentation files) that have documentation when generating Lib/pydoc_data/topics.py, and teach pydoc.help to not include the link when it knows the module doesn't have documentation.
This is a much more complete solution that also avoids creating links for private modules (see bpo-45717), but is significantly more effort to implement.
Joshuah143 commentedon Nov 5, 2021
I think that option 4 would work best but instead of putting any logic in (Lib/pydoc_data/topics.py)[https://github.com/python/cpython/blob/main/Lib/pydoc_data/topics.py] we could put the logic for working with private modules as well and other edge cases in (Lib/pydoc.py)[https://github.com/python/cpython/blob/main/Lib/pydoc.py]. It might make future changes easier.
zware commentedon Nov 5, 2021
This actually turned out to be less effort than I expected (though I still should have been asleep 2 hours ago), so I've gone ahead and opened #29419 to implement what I suggested.
terryjreedy commentedon Nov 8, 2021
PR-29419 solves the issue in bpo-45717 of not giving a link for _* modules with no doc. It does not solve this issue of giving the proper link for module that need non-standard links, which typically need a '#' suffix, as in '.../library/2to3.html#module-lib2to3'. I suggest to continue calculating standard links as done now as the precalculation needs much space for a trivial time saving. Restrict the new dict to non-standard links. They can be calculated, with the needed suffixes, as they are now for the index. The link logic would be to try the lookup first and if module name does not start with '_', calculate the link.
I will add an idlelib section to idle.rst so that 'idlelib' appears in the module index and get entered into the exceptions dict.
I don't see how PR-29459 get linked here as it has no reference to this issue. So I will ignore it at least for know.
merwok commentedon Nov 8, 2021
I think that second PR was linked using the GitHub PR link field present in the bug comment form.
pythongh-84232: Fix doc links in module help() output
pythongh-84232: Fix doc links in module help() output
pythongh-84232: Fix doc links in module help() output
pydocinncorrectly assumes a module has documentation and where #139971 as a duplicate of this issuegh-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…