-
-
Notifications
You must be signed in to change notification settings - Fork 32k
bpo-37755: Use configured output in pydoc instead of pager #15105
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
Conversation
Hello, and thanks for your contribution! I'm a bot set up to make sure that the project can legally accept your contribution by verifying you have signed the PSF contributor agreement (CLA). Our records indicate we have not received your CLA. For legal reasons we need you to sign this before we can look at your contribution. Please follow the steps outlined in the CPython devguide to rectify this issue. If you have recently signed the CLA, please wait at least one business day You can check yourself to see if the CLA has been received. Thanks again for your contribution, we look forward to reviewing it! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please add tests and a NEWS entry.
A Python core developer has requested some changes be made to your pull request before we can consider merging it. If you could please address their requests along with any other requests in other reviews from core developers that would be appreciated. Once you have made the requested changes, please leave a comment on this pull request containing the phrase |
0bb4ee6
to
910baae
Compare
Most changes to Python require a NEWS entry. Add one using the blurb_it web app or the blurb command-line tool. If this change has little impact on Python users, wait for a maintainer to apply the |
910baae
to
c1254ea
Compare
If the Helper() class was initialized with an output, the topics, keywords and symbols help still use the pager instead of the output. Change the behavior so the output is used if available while keeping the previous behavior if no output was configured.
c1254ea
to
207a962
Compare
I have made the requested changes; please review again Though I'm not sure why the Docs action fail, I don't see how the references are incorrect. |
Thanks for making the requested changes! @serhiy-storchaka: please review the changes made to this pull request. |
Misc/NEWS.d/next/Library/2024-06-02-13-35-11.gh-issue-81936.ETeW9x.rst
Outdated
Show resolved
Hide resolved
Lib/test/test_pydoc/test_pydoc.py
Outdated
pydoc.getpager = getpager_new | ||
try: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You can use test.support.swap_attr()
or unittest.mock.patch()
.
It would be nice to test also that the pager was not called (otherwise why do you need to patch it?).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good idea, done.
I modified also the existing test test_help_output_redirect
from which I borrowed the "getpager" handling code. To me it also seems more reasonable to use mocking here.
…1936.ETeW9x.rst Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Very good. But it seems that getpager()
is never called in pydoc
, so mocking it does not have effect. Should not you mock pager
?
Oops, thanks for noticing. I thought I'd like to squash the "fixup" commits or do you want to it yourself on merging? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM.
Usually we only squash on merging.
Thanks @eht16 for the PR, and @serhiy-storchaka for merging it 🌮🎉.. I'm working now to backport this PR to: 3.12, 3.13. |
…15105) If the Helper() class was initialized with an output, the topics, keywords and symbols help still use the pager instead of the output. Change the behavior so the output is used if available while keeping the previous behavior if no output was configured. (cherry picked from commit 2080425) Co-authored-by: Enrico Tröger <enrico.troeger@uvena.de>
Sorry, @eht16 and @serhiy-storchaka, I could not cleanly backport this to
|
GH-120261 is a backport of this pull request to the 3.13 branch. |
…thonGH-15105) If the Helper() class was initialized with an output, the topics, keywords and symbols help still use the pager instead of the output. Change the behavior so the output is used if available while keeping the previous behavior if no output was configured. (cherry picked from commit 2080425) Co-authored-by: Enrico Tröger <enrico.troeger@uvena.de>
GH-120262 is a backport of this pull request to the 3.12 branch. |
…-15105) (GH-120262) If the Helper() class was initialized with an output, the topics, keywords and symbols help still use the pager instead of the output. Change the behavior so the output is used if available while keeping the previous behavior if no output was configured. (cherry picked from commit 2080425) Co-authored-by: Enrico Tröger <enrico.troeger@uvena.de>
…-15105) (GH-120261) If the Helper() class was initialized with an output, the topics, keywords and symbols help still use the pager instead of the output. Change the behavior so the output is used if available while keeping the previous behavior if no output was configured. (cherry picked from commit 2080425) Co-authored-by: Enrico Tröger <enrico.troeger@uvena.de>
…15105) If the Helper() class was initialized with an output, the topics, keywords and symbols help still use the pager instead of the output. Change the behavior so the output is used if available while keeping the previous behavior if no output was configured.
…15105) If the Helper() class was initialized with an output, the topics, keywords and symbols help still use the pager instead of the output. Change the behavior so the output is used if available while keeping the previous behavior if no output was configured.
If the Helper() class was initialized with an output, the topics, keywords and symbols help still use the pager instead of the output.
Change the behavior so the output is used if available while keeping the previous behavior if no output was configured.
https://bugs.python.org/issue37755