![](https://secure.gravatar.com/avatar/8ac615df352a970211b0e3d94a307c6d.jpg?s=120&d=mm&r=g)
Author: georg.brandl Date: Sat Jul 31 23:51:48 2010 New Revision: 83370 Log: #8198: the Helper class should not save the stdin and stdout objects at import time, rather by default use the current streams like the other APIs that output help. Modified: python/branches/py3k/Lib/pydoc.py python/branches/py3k/Misc/NEWS Modified: python/branches/py3k/Lib/pydoc.py ============================================================================== --- python/branches/py3k/Lib/pydoc.py (original) +++ python/branches/py3k/Lib/pydoc.py Sat Jul 31 23:51:48 2010 @@ -1695,9 +1695,17 @@ 'CONTEXTMANAGERS': ('context-managers', 'with'), } - def __init__(self, input, output): - self.input = input - self.output = output + def __init__(self, input=None, output=None): + self._input = input + self._output = output + + @property + def input(self): + return self._input or sys.stdin + + @property + def output(self): + return self._output or sys.stdout def __repr__(self): if inspect.stack()[1][3] == '?': @@ -1874,7 +1882,7 @@ for modules whose descriptions contain the word "spam". ''') -help = Helper(sys.stdin, sys.stdout) +help = Helper() class Scanner: """A generic tree iterator.""" Modified: python/branches/py3k/Misc/NEWS ============================================================================== --- python/branches/py3k/Misc/NEWS (original) +++ python/branches/py3k/Misc/NEWS Sat Jul 31 23:51:48 2010 @@ -15,6 +15,9 @@ Library ------- +- Issue #8198: In pydoc, output all help text to the correct stream + when sys.stdout is reassigned. + - Issue #7909: Do not touch paths with the special prefixes ``\\.\`` or ``\\?\`` in ntpath.normpath().
participants (1)
-
georg.brandl