]> granicus.if.org Git - python/commitdiff
Issue #22314: pydoc now works when the LINES environment variable is set.
authorSerhiy Storchaka <storchaka@gmail.com>
Thu, 27 Nov 2014 22:09:05 +0000 (00:09 +0200)
committerSerhiy Storchaka <storchaka@gmail.com>
Thu, 27 Nov 2014 22:09:05 +0000 (00:09 +0200)
Lib/pydoc.py
Misc/NEWS

index 594e6c789e3e750581c233709506bd69fc5ddba2..0647d1e8ffee56459c92c26ff29abac7cba0bfb2 100755 (executable)
@@ -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 --')
index d3bf2dedc948891bf85d9faa09e803daa3789f30..642ada04986519ad07fb5557fee8b95a63b32acf 100644 (file)
--- a/Misc/NEWS
+++ b/Misc/NEWS
@@ -25,6 +25,8 @@ Documentation
 Tools/Demos
 -----------
 
+- Issue #22314: pydoc now works when the LINES environment variable is set.
+
 - Issue #18905: "pydoc -p 0" now outputs actually used port.  Based on patch by
   Wieland Hoffmann.