Skip to content

pydoc should return non-zero exit code when a query is not found #89130

Description

@gpanders
mannequin
BPO 44967
Nosy @ambv, @gpanders
PRs
  • bpo-44967: pydoc: return non-zero exit code when query is not found #27868
  • 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 = <Date 2021-08-26.12:22:34.340>
    created_at = <Date 2021-08-21.03:22:27.007>
    labels = ['type-feature', '3.11']
    title = 'pydoc should return non-zero exit code when a query is not found'
    updated_at = <Date 2021-08-26.12:22:34.339>
    user = 'https://github.com/gpanders'

    bugs.python.org fields:

    activity = <Date 2021-08-26.12:22:34.339>
    actor = 'lukasz.langa'
    assignee = 'none'
    closed = True
    closed_date = <Date 2021-08-26.12:22:34.340>
    closer = 'lukasz.langa'
    components = ['Demos and Tools']
    creation = <Date 2021-08-21.03:22:27.007>
    creator = 'gpanders'
    dependencies = []
    files = []
    hgrepos = []
    issue_num = 44967
    keywords = ['patch']
    message_count = 3.0
    messages = ['400012', '400339', '400340']
    nosy_count = 2.0
    nosy_names = ['lukasz.langa', 'gpanders']
    pr_nums = ['27868']
    priority = 'normal'
    resolution = 'fixed'
    stage = 'resolved'
    status = 'closed'
    superseder = None
    type = 'enhancement'
    url = 'https://bugs.python.org/issue44967'
    versions = ['Python 3.11']

    Activity

    1. gpanders commented on Aug 21, 2021

      gpandersmannequin
      MannequinAuthor

      Currently pydoc returns an exit code of zero no matter what, even with e.g.

      pydoc lsjdfkdfj
      

      However, the ability to know whether or not pydoc successfully found a result is useful in tools that embed pydoc in some way.

      Here's one use case: Vim and Neovim have a feature that allows a user to run an external command for the keyword under the cursor (keywordprg). In Python files, this defaults to pydoc. In Neovim, we would like to automatically close the PTY buffers that we create for these processes when they finish without any errors, but if it returns a non-zero exit code we want to keep the PTY buffer open so the user can see what went wrong. Because pydoc returns immediately when it fails to find a match and does not indicate that it failed via a return code, the PTY buffer is closed immediately with no indication to the user that anything went wrong.

      I have a patch prepared for this that I will link to the issue.

    2. ambv commented on Aug 26, 2021

      @ambv
      Contributor

      New changeset 8868d48 by Gregory Anders in branch 'main':
      bpo-44967: pydoc: return non-zero exit code when query is not found (GH-27868)
      8868d48

    3. ambv commented on Aug 26, 2021

      @ambv
      Contributor

      Thanks for the report and fix, Gregory! ✨ 🍰 ✨

    4. transferred this issue fromon Apr 10, 2022
    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.11only security fixestype-featureA feature request or enhancement

      Projects

      No projects

        Milestone

        No milestone

        Relationships

        None yet

        Development

        No branches or pull requests

        Issue actions