Skip to content

New pyrepl gives a traceback on exit with "dumb" terminal#119102

@dgrisby

Description

@dgrisby

Bug report

Bug description:

I was experimenting with terminal types:

$ export TERM=dumb $ python3 Python 3.13.0b1 (main, May 12 2024, 23:38:03) [GCC 13.2.1 20240316 (Red Hat 13.2.1-7)] on linux Type "help", "copyright", "credits" or "license" for more information. warning: can't use pyrepl: terminal doesn't have the required clear capability >>> quit Use quit() or Ctrl-D (i.e. EOF) to exit >>> quit() Exception ignored in atexit callback <function register_readline.<locals>.write_history at 0x7f7204f537e0>: Traceback (most recent call last): File "<frozen site>", line 530, in write_history File "/home/duncan/py313inst/lib/python3.13/_pyrepl/readline.py", line 361, in write_history_file history = self.get_reader().get_trimmed_history(maxlength) File "/home/duncan/py313inst/lib/python3.13/_pyrepl/readline.py", line 277, in get_reader console = UnixConsole(self.f_in, self.f_out, encoding=ENCODING) File "/home/duncan/omni/py313inst/lib/python3.13/_pyrepl/unix_console.py", line 170, in __init__ self._clear = _my_getstr("clear") File "/home/duncan/py313inst/lib/python3.13/_pyrepl/unix_console.py", line 163, in _my_getstr raise InvalidTerminal( _pyrepl.unix_console.InvalidTerminal: terminal doesn't have the required clear capability 

It notices that the terminal is unsuitable, but then tries to use it on exit.

CPython versions tested on:

3.13

Operating systems tested on:

Linux

Linked PRs

Metadata

Metadata

Assignees

No one assigned

    Labels

    3.13bugs and security fixestopic-replRelated to the interactive shelltype-bugAn unexpected behavior, bug, or error

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions