summaryrefslogtreecommitdiffstats
path: root/Lib/pydoc.py
diff options
context:
space:
mode:
authorSerhiy Storchaka <storchaka@gmail.com>2014-11-27 22:09:05 (GMT)
committerSerhiy Storchaka <storchaka@gmail.com>2014-11-27 22:09:05 (GMT)
commit46e92503dab0311b4d000747b8a6f2d2a68e39ad (patch)
tree70daa3fc36dbb1a57a7e1bb085c5fa522804f5fa /Lib/pydoc.py
parent86ef95d3fbd121fec1168b87ddfe027273b38cea (diff)
downloadcpython-46e92503dab0311b4d000747b8a6f2d2a68e39ad.zip
cpython-46e92503dab0311b4d000747b8a6f2d2a68e39ad.tar.gz
cpython-46e92503dab0311b4d000747b8a6f2d2a68e39ad.tar.bz2
Issue #22314: pydoc now works when the LINES environment variable is set.
Diffstat (limited to 'Lib/pydoc.py')
-rwxr-xr-xLib/pydoc.py8
1 files changed, 7 insertions, 1 deletions
diff --git a/Lib/pydoc.py b/Lib/pydoc.py
index 594e6c7..0647d1e 100755
--- a/Lib/pydoc.py
+++ b/Lib/pydoc.py
@@ -1446,7 +1446,13 @@ def ttypager(text):
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(join(lines[:inc], '\n') + '\n')
while lines[r:]:
sys.stdout.write('-- more --')