diff options
| author | Miss Islington (bot) <31488909+miss-islington@users.noreply.github.com> | 2024-05-22 18:38:32 (GMT) |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2024-05-22 18:38:32 (GMT) |
| commit | cd39da75afbede2e5f012065fedd709bf74a9c5f (patch) | |
| tree | 30f1870989460378aa6c9ade443ed6b3ceda936d /Lib/_pyrepl/pager.py | |
| parent | bfd9c3ea5336f2898e3c58e0c3999bfc25d7da89 (diff) | |
| download | cpython-cd39da75afbede2e5f012065fedd709bf74a9c5f.zip cpython-cd39da75afbede2e5f012065fedd709bf74a9c5f.tar.gz cpython-cd39da75afbede2e5f012065fedd709bf74a9c5f.tar.bz2 | |
[3.13] Improve `pyrepl` type-annotation coverage (GH-119081) (#119415)
(cherry picked from commit 033f5c87f1f876088701d1ae078dc39c41177d4a)
Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>
Diffstat (limited to 'Lib/_pyrepl/pager.py')
| -rw-r--r-- | Lib/_pyrepl/pager.py | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/Lib/_pyrepl/pager.py b/Lib/_pyrepl/pager.py index 1c8c1bb..1ac733e 100644 --- a/Lib/_pyrepl/pager.py +++ b/Lib/_pyrepl/pager.py @@ -76,10 +76,14 @@ def tty_pager(text: str, title: str = '') -> None: fd = sys.stdin.fileno() old = termios.tcgetattr(fd) tty.setcbreak(fd) - getchar = lambda: sys.stdin.read(1) has_tty = True + + def getchar() -> str: + return sys.stdin.read(1) + except (ImportError, AttributeError, io.UnsupportedOperation): - getchar = lambda: sys.stdin.readline()[:-1][:1] + def getchar() -> str: + return sys.stdin.readline()[:-1][:1] try: try: |
