Repository navigation
Conversation
ZeroIntensity
left a comment
There was a problem hiding this comment.
I think it's worth adding an entry to the "What's New in Python 3.15" page too, because this seems like a feature, not a bugfix.
Co-authored-by: Peter Bierma <zintensitydev@gmail.com>
I'm not sure, just because this PR alone represents pretty minor tweaks to Of course, happy to defer to y'all's judgment, though. |
|
Alternatively, we could add a |
|
This PR is stale because it has been open for 30 days with no activity. |
|
|
||
| def test_fail_help_cli(self): | ||
| elines = (missing_pattern % 'abd').splitlines() | ||
| elines = (missing_pattern % 'abd').splitlines(False)[:1] |
There was a problem hiding this comment.
Positional boolean arguments are a code smell because they're often unreadable. Could you change this (and other occurrences) to splitlines(keepends=False)?
| elif isinstance(request, (Helper, type(builtins.help))): | ||
| self.helphelp(is_interactive=is_interactive) |
There was a problem hiding this comment.
When Python is started without site initialization (-S), builtins.help isn't available, so this will raise an exception when pydoc.help is invoked manually. Let's use _sitebuiltins._Helper instead.
| if is_interactive: | ||
| self.intro() | ||
| else: | ||
| pager(textwrap.dedent("""\ |
There was a problem hiding this comment.
Calls to pager() need to be guarded by a self.output is None check, because we don't want to start the pager when output is being redirected. So, we want something like this instead:
help_text = textwrap.dedent(...)
if is_interactive:
self.intro()
elif self._output is None:
pager(help_text)
else:
self.output.write(help_text)| @@ -0,0 +1,2 @@ | |||
| Removed potentially-misleading suggestions from the interactive :func:`help` | |||
There was a problem hiding this comment.
I think the dash is unnecessary here? Correct me if I'm wrong on this one.
| Removed potentially-misleading suggestions from the interactive :func:`help` | |
| Removed potentially misleading suggestions from the interactive :func:`help` |
This PR represents an attempt to address both of the issues raised in #138094 by changing how
help(help)is handled, and by removing suggested calls tohelp(...)in the output when we can't find a given topic in interactive mode.Happy to adjust if need be (or to separate this into 2 PR's if that would be better).
helpfunction: misleading output in interactive mode, confusing output forhelp(help)#138094