pydoc should return non-zero exit code when a query is not found #89130
Copy link
Copy link
Closed
Labels
3.11only security fixesonly security fixestype-featureA feature request or enhancementA feature request or enhancement
Description
| BPO | 44967 |
|---|---|
| Nosy | @ambv, @gpanders |
| PRs |
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']Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
3.11only security fixesonly security fixestype-featureA feature request or enhancementA feature request or enhancement
Activity
gpanders commentedon Aug 21, 2021
Currently pydoc returns an exit code of zero no matter what, even with e.g.
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.
ambv commentedon 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 commentedon Aug 26, 2021
Thanks for the report and fix, Gregory! ✨ 🍰 ✨