Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

pydoc topics, keywords and symbols always use pager instead of output #81936

Closed
eht16 mannequin opened this issue Aug 4, 2019 · 3 comments
Closed

pydoc topics, keywords and symbols always use pager instead of output #81936

eht16 mannequin opened this issue Aug 4, 2019 · 3 comments
Labels
3.12 bugs and security fixes 3.13 bugs and security fixes 3.14 new features, bugs and security fixes stdlib Python modules in the Lib dir type-bug An unexpected behavior, bug, or error

Comments

@eht16
Copy link
Mannequin

eht16 mannequin commented Aug 4, 2019

BPO 37755
Nosy @eht16
PRs
  • bpo-37755: Use configured output in pydoc instead of pager #15105
  • 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 2019-08-04.12:48:20.274>
    labels = ['3.8', 'type-bug', 'library']
    title = 'pydoc topics, keywords and symbols always use pager instead of output'
    updated_at = <Date 2019-08-04.12:55:23.691>
    user = 'https://github.com/eht16'

    bugs.python.org fields:

    activity = <Date 2019-08-04.12:55:23.691>
    actor = 'eht16'
    assignee = 'none'
    closed = False
    closed_date = None
    closer = None
    components = ['Library (Lib)']
    creation = <Date 2019-08-04.12:48:20.274>
    creator = 'eht16'
    dependencies = []
    files = []
    hgrepos = []
    issue_num = 37755
    keywords = ['patch']
    message_count = 1.0
    messages = ['348983']
    nosy_count = 1.0
    nosy_names = ['eht16']
    pr_nums = ['15105']
    priority = 'normal'
    resolution = None
    stage = 'patch review'
    status = 'open'
    superseder = None
    type = 'behavior'
    url = 'https://bugs.python.org/issue37755'
    versions = ['Python 3.8']

    @eht16
    Copy link
    Mannequin Author

    eht16 mannequin commented Aug 4, 2019

    I noticed a probably unintended behavior in help() usage:

    when an output is set on pydoc.Helper(), most of its methods
    use this output instead of a pager.
    But 'True', 'False' and 'None' as well as all topics, keywords
    and symbols always use a pager instead of the configured output.

    My use case is to use the pydoc help system to display help contents
    in Geany (a text editor) in a graphical manner
    (and so I cannot make any use of a pager).

    Example code:

    #!/usr/bin/env python3
    # -- coding: utf-8 --

    from io import StringIO
    import pydoc
    import sys
    
    
    if __name__ == '__main__':
        help_text = StringIO()
    
        helper = pydoc.Helper(output=help_text)
        # help contents are written to help_text as expected
        helper.help('pydoc')
    
        # the following calls each show the help contents in a pager instead
        # of using the configured output
        helper.help('True')
        helper.help('False')
        helper.help('None')
        helper.help('**')  # symbol example
        helper.help('SEQUENCES')  # topic example
        helper.help('await')  # keyword example

    Tested against Python 3.7.3.

    @eht16 eht16 mannequin added 3.8 only security fixes stdlib Python modules in the Lib dir type-bug An unexpected behavior, bug, or error labels Aug 4, 2019
    @ezio-melotti ezio-melotti transferred this issue from another repository Apr 10, 2022
    @serhiy-storchaka serhiy-storchaka added 3.12 bugs and security fixes 3.13 bugs and security fixes 3.14 new features, bugs and security fixes and removed 3.8 only security fixes labels Jun 8, 2024
    @serhiy-storchaka
    Copy link
    Member

    Thank you for your contribution @eht16. Sorry it took so long to review and merge your PR.

    @eht16
    Copy link
    Contributor

    eht16 commented Jun 8, 2024

    It took me to answer almost as long :D.
    Thank you for the review.

    Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
    Labels
    3.12 bugs and security fixes 3.13 bugs and security fixes 3.14 new features, bugs and security fixes stdlib Python modules in the Lib dir type-bug An unexpected behavior, bug, or error
    Projects
    None yet
    Development

    No branches or pull requests

    2 participants