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.Helper.help() ignores input/output init parameters #40177

Closed
tws5 mannequin opened this issue Apr 22, 2004 · 15 comments
Closed

pydoc.Helper.help() ignores input/output init parameters #40177

tws5 mannequin opened this issue Apr 22, 2004 · 15 comments
Assignees
Labels
3.7 (EOL) end of life 3.8 only security fixes stdlib Python modules in the Lib dir type-bug An unexpected behavior, bug, or error

Comments

@tws5
Copy link
Mannequin

tws5 mannequin commented Apr 22, 2004

BPO 940286
Nosy @birkenfeld, @abalkin, @devdanzin, @merwok, @berkerpeksag, @miss-islington
PRs
  • bpo-940286: Fix pydoc to show cross refs correctly #8390
  • [3.7] bpo-940286: Fix pydoc to show cross refs correctly (GH-8390) #8402
  • [3.6] bpo-940286: Fix pydoc to show cross refs correctly (GH-8390) #8403
  • Files
  • helpredirect.diff: patch for issue 940286
  • 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 = 'https://github.com/berkerpeksag'
    closed_at = <Date 2018-07-23.06:53:53.396>
    created_at = <Date 2004-04-22.20:11:10.000>
    labels = ['3.7', '3.8', 'type-bug', 'library']
    title = 'pydoc.Helper.help() ignores input/output init parameters'
    updated_at = <Date 2018-07-23.06:53:53.395>
    user = 'https://bugs.python.org/tws5'

    bugs.python.org fields:

    activity = <Date 2018-07-23.06:53:53.395>
    actor = 'berker.peksag'
    assignee = 'berker.peksag'
    closed = True
    closed_date = <Date 2018-07-23.06:53:53.396>
    closer = 'berker.peksag'
    components = ['Library (Lib)']
    creation = <Date 2004-04-22.20:11:10.000>
    creator = 'tws5'
    dependencies = []
    files = ['19756']
    hgrepos = []
    issue_num = 940286
    keywords = ['patch']
    message_count = 15.0
    messages = ['60481', '82047', '122002', '122004', '122009', '122599', '123198', '127840', '128199', '190051', '322131', '322173', '322175', '322183', '322184']
    nosy_count = 8.0
    nosy_names = ['georg.brandl', 'belopolsky', 'ajaksu2', 'tws5', 'eric.araujo', 'bkad', 'berker.peksag', 'miss-islington']
    pr_nums = ['8390', '8402', '8403']
    priority = 'normal'
    resolution = 'fixed'
    stage = 'resolved'
    status = 'closed'
    superseder = None
    type = 'behavior'
    url = 'https://bugs.python.org/issue940286'
    versions = ['Python 3.6', 'Python 3.7', 'Python 3.8']

    @tws5
    Copy link
    Mannequin Author

    tws5 mannequin commented Apr 22, 2004

    The ourput of pydoc.Helper help() method is always sent
    to sys.stdout, even if Helper was supplied with
    different input/output streams at initialization. Other
    methods: listtopics etc. work as expected.

    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:
    '2.3 (#46, Aug 11 2003, 09:34:05) [MSC v.1200 32 bit
    (Intel)]'

    The problem persists in pydoc.py version 1.90 from CVS.

    The reason for such behaviour is a call to global (in
    module scope) function doc() at line 1628 in pydoc.py 1.90.
    which doesn't care about Helper.input Helper.output
    settings.

    @tws5 tws5 mannequin added stdlib Python modules in the Lib dir labels Apr 22, 2004
    @devdanzin
    Copy link
    Mannequin

    devdanzin mannequin commented Feb 14, 2009

    Confirmed. Is it relevant?

    @devdanzin devdanzin mannequin added type-bug An unexpected behavior, bug, or error labels Feb 14, 2009
    @devdanzin devdanzin mannequin added easy labels Apr 22, 2009
    @bkad
    Copy link
    Mannequin

    bkad mannequin commented Nov 21, 2010

    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.

    @bkad
    Copy link
    Mannequin

    bkad mannequin commented Nov 21, 2010

    Created a rietveld review
    http://codereview.appspot.com/3202042

    @merwok
    Copy link
    Member

    merwok commented Nov 21, 2010

    Thanks for the patch. I commented there.

    @merwok
    Copy link
    Member

    merwok commented Nov 28, 2010

    Patchset 3 on codereview looks good. I’d like another review, so I’m adding the latest developers who touched pydoc.

    @birkenfeld
    Copy link
    Member

    Looks good; committed in r86957.

    @merwok
    Copy link
    Member

    merwok commented Feb 4, 2011

    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?

    @merwok merwok reopened this Feb 6, 2011
    @merwok merwok reopened this Feb 6, 2011
    @bkad
    Copy link
    Mannequin

    bkad mannequin commented Feb 8, 2011

    confirmed, I'll take a closer look

    @BreamoreBoy
    Copy link
    Mannequin

    BreamoreBoy mannequin commented May 26, 2013

    One commit already so presumably not too much effort needed to close this one.

    @berkerpeksag
    Copy link
    Member

    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?

    @berkerpeksag berkerpeksag added 3.7 (EOL) end of life 3.8 only security fixes and removed easy labels Jul 22, 2018
    @merwok
    Copy link
    Member

    merwok commented Jul 23, 2018

    Patch works!

    @merwok merwok assigned berkerpeksag and unassigned merwok Jul 23, 2018
    @berkerpeksag
    Copy link
    Member

    New changeset d04f46c by Berker Peksag in branch 'master':
    bpo-940286: Fix pydoc to show cross refs correctly (GH-8390)
    d04f46c

    @miss-islington
    Copy link
    Contributor

    New changeset e9e6495 by Miss Islington (bot) in branch '3.6':
    bpo-940286: Fix pydoc to show cross refs correctly (GH-8390)
    e9e6495

    @berkerpeksag
    Copy link
    Member

    New changeset 14f58f0 by Berker Peksag (Miss Islington (bot)) in branch '3.7':
    bpo-940286: Fix pydoc to show cross refs correctly (GH-8390)
    14f58f0

    @ezio-melotti ezio-melotti transferred this issue from another repository Apr 9, 2022
    Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
    Labels
    3.7 (EOL) end of life 3.8 only security fixes stdlib Python modules in the Lib dir type-bug An unexpected behavior, bug, or error
    Projects
    None yet
    Development

    No branches or pull requests

    4 participants