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.Helper.help() ignores input/output init parameters #40177
Comments
The ourput of pydoc.Helper help() method is always sent Example: import sys, pydoc
from StringIO import StringIO
buf=StringIO()
H=pydoc.Helper(sys.stdin,buf)
H.listtopics()
H.help("pydoc")
#at this point help on pydoc is printed to stdout
H.listtopics()
ss=buf.getvalue()
print ss
#at this point the list of topics is printed twice ######################## sys.version: The problem persists in pydoc.py version 1.90 from CVS. The reason for such behaviour is a call to global (in |
Confirmed. Is it relevant? |
This patch redirects output from Helper.help to whatever output stream is passed to the Helper constructor. If no output stream is specified, the fault behavior is to pass the output to the OS pager. |
Created a rietveld review |
Thanks for the patch. I commented there. |
Patchset 3 on codereview looks good. I’d like another review, so I’m adding the latest developers who touched pydoc. |
Looks good; committed in r86957. |
I just added another comment on Rietveld because I thought this was not fixed :) Demo session: $ pydoc3.2 nonlocal # will launch my pager, then print to stdout
Related help topics: global, NAMESPACES Kevin Le, would you like to write a failing test to confirm my bug? |
confirmed, I'll take a closer look |
One commit already so presumably not too much effort needed to close this one. |
I just noticed the same bug described by Éric in msg127840. PR 8390 should fix it. Unfortunately, it wasn't easy to create a test case, so I skipped that part. I'm open to suggestions if you have an idea on how to write a simple test that reproduces the bug. Éric, could you confirm that the attached PR fixes the bug? |
Patch works! |
New changeset d04f46c by Berker Peksag in branch 'master': |
New changeset e9e6495 by Miss Islington (bot) in branch '3.6': |
New changeset 14f58f0 by Berker Peksag (Miss Islington (bot)) in branch '3.7': |
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:
bugs.python.org fields:
The text was updated successfully, but these errors were encountered: