[Python-checkins] r83370 - in python/branches/py3k: Lib/pydoc.py Misc/NEWS
georg.brandl
python-checkins at python.org
Sat Jul 31 23:51:48 CEST 2010
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().
More information about the Python-checkins
mailing list