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 should return non-zero exit code when a query is not found #89130

Closed
gpanders mannequin opened this issue Aug 21, 2021 · 3 comments
Closed

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

gpanders mannequin opened this issue Aug 21, 2021 · 3 comments
Labels
3.11 only security fixes type-feature A feature request or enhancement

Comments

@gpanders
Copy link
Mannequin

gpanders mannequin commented Aug 21, 2021

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']

    @gpanders
    Copy link
    Mannequin Author

    gpanders mannequin commented Aug 21, 2021

    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.

    @gpanders gpanders mannequin added type-feature A feature request or enhancement labels Aug 21, 2021
    @ambv
    Copy link
    Contributor

    ambv commented Aug 26, 2021

    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

    @ambv
    Copy link
    Contributor

    ambv commented Aug 26, 2021

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

    @ambv ambv added the 3.11 only security fixes label Aug 26, 2021
    @ambv ambv closed this as completed Aug 26, 2021
    @ambv ambv added the 3.11 only security fixes label Aug 26, 2021
    @ambv ambv closed this as completed Aug 26, 2021
    @ezio-melotti ezio-melotti transferred this issue from another repository Apr 10, 2022
    Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
    Labels
    3.11 only security fixes type-feature A feature request or enhancement
    Projects
    None yet
    Development

    No branches or pull requests

    1 participant