Commit f1fc9fb3 authored by Serhiy Storchaka's avatar Serhiy Storchaka

Issue #22314: pydoc now works when the LINES environment variable is set.

parents 5916d530 ab5e9b92
......@@ -1477,12 +1477,18 @@ def ttypager(text):
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 --')
......
......@@ -383,6 +383,11 @@ Library
- 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.
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment