Skip to content

Give proper link in help(idlelib/turtledemo/tkinter.sub/test_*/?) #84232

Description

@wyz23x2
mannequin
BPO 40051
Nosy @smontanaro, @terryjreedy, @merwok, @bitdancer, @vadmium, @zware, @wyz23x2, @Joshuah143
PRs
  • gh-84232: Fix doc links in module help() output #29419
  • General cleanup of test_pydoc #29459
  • 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

    Activity

    1. wyz23x2 commented on Mar 24, 2020

      wyz23x2mannequin
      MannequinAuthor
      When typing this in shell:
      >>> import lib2to3
      >>> help(lib2to3)

      The output contains this link:
      --snip--
      MODULE REFERENCE
      https://docs.python.org/3.8/library/lib2to3 <--

      The following documentation is automatically generated from the Python
      

      --snip--

      But when you access it, 404!
      This works:
      https://docs.python.org/3.8/library/2to3.html#module-lib2to3

      Please change it. Thanks!

    2. added
      performancePerformance or resource usage
      docsDocumentation in the Doc dir
      stdlibStandard Library Python modules in the Lib/ directory
      on Mar 24, 2020
    3. added
      performancePerformance or resource usage
      docsDocumentation in the Doc dir
      stdlibStandard Library Python modules in the Lib/ directory
      on Mar 24, 2020
    4. terryjreedy commented on Mar 28, 2020

      @terryjreedy
      Member

      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:

      1. 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.

      2. Auto redirection: persuade whoever manages docs.python.org to add
        a redirection for lib2to3. Fragile.

      3. 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?

    5. 56 remaining items

    6. added
      3.13only security fixes
      3.14bugs and security fixes
      3.15bugs and security fixes
      on Dec 15, 2025
    7. added a commit that references this issue on Dec 23, 2025
    8. merwok commented on Dec 23, 2025

      @merwok
      Member

      @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)

    9. added a commit that references this issue on Dec 23, 2025
    10. added 3 commits that reference this issue on Dec 23, 2025
    Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

    Metadata

    Metadata

    Assignees

    No one assigned

      Labels

      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

      Projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions