Message101981
Nice buglet, please take a look at Lib/pydoc.py to follow :)
As you point out, this is issue 1700304.
'plainpager', which outputs the help in these cases, uses 'sys.stdout.write(plain(text))', but Helper.help has a "self.output.write('\n')" line that causes the behavior you see.
We could change "self.output.write('\n')" to "pager('\n')", but the real bug is that self.output is bound early to sys.stdout. So 'help()' is still redirecting to the old sys.stdout with your test.
I see a solution by turning Helper.output into a property, but it smells of over-engineering :) Passing all output to pagers should work too, unless we need Helper.output as a sort of sys.stderr.
The patch below shows that importing pydoc sets self.output prematurely and includes the "self.output.write('\n')" line.
Index: pydoc.py
===================================================================
--- pydoc.py (revision 79447)
+++ pydoc.py (working copy)
@@ -1765,6 +1765,7 @@
elif isinstance(request, Helper): self()
else: doc(request, 'Help on %s:')
self.output.write('\n')
+ print >> sys.stderr, repr(self.output)
def intro(self):
self.output.write(''' |
|
Date |
User |
Action |
Args |
2010-03-31 06:14:33 | ajaksu2 | set | recipients:
+ ajaksu2, farialima |
2010-03-31 06:14:33 | ajaksu2 | set | messageid: <1270016073.18.0.806961616916.issue8198@psf.upfronthosting.co.za> |
2010-03-31 06:14:31 | ajaksu2 | link | issue8198 messages |
2010-03-31 06:14:30 | ajaksu2 | create | |
|