[Python-checkins] cpython (merge 3.4 -> default): Issue #22314: pydoc now works when the LINES environment variable is set.
serhiy.storchaka
python-checkins at python.org
Thu Nov 27 23:15:47 CET 2014
https://hg.python.org/cpython/rev/c8adee8a0ccb
changeset: 93632:c8adee8a0ccb
parent: 93628:ce9881eecfb4
parent: 93631:c6182a7e75fa
user: Serhiy Storchaka <storchaka at gmail.com>
date: Fri Nov 28 00:11:07 2014 +0200
summary:
Issue #22314: pydoc now works when the LINES environment variable is set.
files:
Lib/pydoc.py | 10 ++++++++--
Misc/NEWS | 5 +++++
2 files changed, 13 insertions(+), 2 deletions(-)
diff --git a/Lib/pydoc.py b/Lib/pydoc.py
--- a/Lib/pydoc.py
+++ b/Lib/pydoc.py
@@ -1477,12 +1477,18 @@
old = tty.tcgetattr(fd)
tty.setcbreak(fd)
getchar = lambda: sys.stdin.read(1)
- except (ImportError, AttributeError):
+ except (ImportError, AttributeError, io.UnsupportedOperation):
tty = None
getchar = lambda: sys.stdin.readline()[:-1][:1]
try:
- r = inc = os.environ.get('LINES', 25) - 1
+ try:
+ h = int(os.environ.get('LINES', 0))
+ except ValueError:
+ h = 0
+ if h <= 1:
+ h = 25
+ r = inc = h - 1
sys.stdout.write('\n'.join(lines[:inc]) + '\n')
while lines[r:]:
sys.stdout.write('-- more --')
diff --git a/Misc/NEWS b/Misc/NEWS
--- a/Misc/NEWS
+++ b/Misc/NEWS
@@ -383,6 +383,11 @@
- Issue #17442: InteractiveInterpreter now displays the full chained traceback
in its showtraceback method, to match the built in interactive interpreter.
+Tools/Demos
+-----------
+
+- Issue #22314: pydoc now works when the LINES environment variable is set.
+
- Issue #10510: distutils register and upload methods now use HTML standards
compliant CRLF line endings.
--
Repository URL: https://hg.python.org/cpython
More information about the Python-checkins
mailing list