Title: ignores input/output init parameters
Type: behavior Stage: patch review
Components: Library (Lib) Versions: Python 3.1, Python 3.2, Python 2.7
Status: open Resolution: fixed
Dependencies: Superseder:
Assigned To: eric.araujo Nosy List: ajaksu2, belopolsky, bkad, eric.araujo, georg.brandl, tws5
Priority: normal Keywords: easy, patch

Created on 2004-04-22 20:11 by tws5, last changed 2014-02-03 17:13 by BreamoreBoy.

File name Uploaded Description Edit
helpredirect.diff bkad, 2010-11-21 22:03 patch for issue 940286 review
Messages (10)
msg60481 - (view) Author: Maxim Krikun (tws5) Date: 2004-04-22 20:11
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.


import sys, pydoc
from StringIO import StringIO


#at this point help on pydoc is printed to stdout

print ss
#at this point the list of topics is printed twice


 '2.3 (#46, Aug 11 2003, 09:34:05) [MSC v.1200 32 bit

The problem persists in version 1.90 from CVS.

The reason for such behaviour is a call to global (in
module scope) function doc() at line 1628 in 1.90.
which doesn't care about Helper.input Helper.output
msg82047 - (view) Author: Daniel Diniz (ajaksu2) Date: 2009-02-14 13:53
Confirmed. Is it relevant?
msg122002 - (view) Author: Kevin Le (bkad) Date: 2010-11-21 22:03
This patch redirects output from 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.
msg122004 - (view) Author: Kevin Le (bkad) Date: 2010-11-21 22:31
Created a rietveld review
msg122009 - (view) Author: Éric Araujo (eric.araujo) * (Python committer) Date: 2010-11-21 22:48
Thanks for the patch.  I commented there.
msg122599 - (view) Author: Éric Araujo (eric.araujo) * (Python committer) Date: 2010-11-28 02:11
Patchset 3 on codereview looks good.  I’d like another review, so I’m adding the latest developers who touched pydoc.
msg123198 - (view) Author: Georg Brandl (georg.brandl) * (Python committer) Date: 2010-12-03 07:47
Looks good; committed in r86957.
msg127840 - (view) Author: Éric Araujo (eric.araujo) * (Python committer) Date: 2011-02-04 00:32
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?
msg128199 - (view) Author: Kevin Le (bkad) Date: 2011-02-08 23:24
confirmed, I'll take a closer look
msg190051 - (view) Author: Mark Lawrence (BreamoreBoy) * Date: 2013-05-26 02:59
One commit already so presumably not too much effort needed to close this one.
Date User Action Args
2014-02-03 17:13:36BreamoreBoysetnosy: - BreamoreBoy
2013-05-26 02:59:01BreamoreBoysetnosy: + BreamoreBoy
messages: + msg190051
2011-06-14 15:46:02eric.araujolinkissue10457 superseder
2011-02-08 23:24:43bkadsetnosy: georg.brandl, belopolsky, ajaksu2, tws5, eric.araujo, bkad
messages: + msg128199
2011-02-06 18:48:23eric.araujosetstatus: closed -> open
nosy: georg.brandl, belopolsky, ajaksu2, tws5, eric.araujo, bkad
2011-02-04 00:32:46eric.araujosetnosy: georg.brandl, belopolsky, ajaksu2, tws5, eric.araujo, bkad
messages: + msg127840
2010-12-03 07:47:28georg.brandlsetstatus: open -> closed
resolution: fixed
messages: + msg123198
2010-11-28 02:11:16eric.araujosetnosy: + georg.brandl, belopolsky
messages: + msg122599
2010-11-28 01:59:47eric.araujosetassignee: eric.araujo
versions: - Python 2.6
2010-11-22 13:37:15eric.araujosetstage: test needed -> patch review
versions: + Python 3.1, Python 2.7
2010-11-21 22:48:22eric.araujosetnosy: + eric.araujo
messages: + msg122009
2010-11-21 22:31:01bkadsetmessages: + msg122004
2010-11-21 22:03:44bkadsetfiles: + helpredirect.diff
versions: + Python 3.2
nosy: + bkad

messages: + msg122002

keywords: + patch
2009-04-22 17:16:39ajaksu2setkeywords: + easy
stage: test needed
2009-02-14 13:53:53ajaksu2settype: behavior
messages: + msg82047
nosy: + ajaksu2
versions: + Python 2.6, - Python 2.3
2004-04-22 20:11:10tws5create