This fixes the issue where an InvalidTerminal error is being thrown when TERM is set to dumb.
(venv) src/cpython (gh-119102) % ./python.exe
Python 3.14.0a0 (heads/main-dirty:ab4263a82a, May 21 2024, 11:15:42) [Clang 15.0.0 (clang-1500.3.9.4)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> exit
(venv) src/cpython (gh-119102) % TERM=dumb ./python.exe
Python 3.14.0a0 (heads/main-dirty:ab4263a82a, May 21 2024, 11:15:42) [Clang 15.0.0 (clang-1500.3.9.4)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
warning: can't use pyrepl: terminal doesn't have the required clear capability
>>> quit()
(venv) src/cpython (gh-119102) %
On the main branch, we have the following behavior:
(venv) src/cpython (main) % TERM=dumb ./python.exe
Python 3.14.0a0 (heads/main-dirty:ab4263a82a, May 21 2024, 11:15:42) [Clang 15.0.0 (clang-1500.3.9.4)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
warning: can't use pyrepl: terminal doesn't have the required clear capability
>>> quit()
Exception ignored in atexit callback <function register_readline.<locals>.write_history at 0x103b57a10>:
Traceback (most recent call last):
File "/Users/eugene/src/cpython/Lib/site.py", line 531, in write_history
_pyrepl.readline.write_history_file(history)
File "/Users/eugene/src/cpython/Lib/_pyrepl/readline.py", line 364, in write_history_file
history = self.get_reader().get_trimmed_history(maxlength)
File "/Users/eugene/src/cpython/Lib/_pyrepl/readline.py", line 280, in get_reader
console = UnixConsole(self.f_in, self.f_out, encoding=ENCODING)
File "/Users/eugene/src/cpython/Lib/_pyrepl/unix_console.py", line 180, in __init__
self._clear = _my_getstr("clear")
File "/Users/eugene/src/cpython/Lib/_pyrepl/unix_console.py", line 173, in _my_getstr
raise InvalidTerminal(
_pyrepl.unix_console.InvalidTerminal: terminal doesn't have the required clear capability
TODO: The test needs a little bit of tweaking still.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
FFY00
Awaiting requested review from FFY00
FFY00 will be requested when the pull request is marked ready for review
FFY00 is a code owner
warsaw
Awaiting requested review from warsaw
warsaw will be requested when the pull request is marked ready for review
warsaw is a code owner
pablogsal
Awaiting requested review from pablogsal
pablogsal will be requested when the pull request is marked ready for review
pablogsal is a code owner
lysnikolaou
Awaiting requested review from lysnikolaou
lysnikolaou will be requested when the pull request is marked ready for review
lysnikolaou is a code owner
ambv
Awaiting requested review from ambv
ambv will be requested when the pull request is marked ready for review
ambv is a code owner
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This fixes the issue where an InvalidTerminal error is being thrown when TERM is set to dumb.
On the main branch, we have the following behavior:
(venv) src/cpython (main) % TERM=dumb ./python.exe Python 3.14.0a0 (heads/main-dirty:ab4263a82a, May 21 2024, 11:15:42) [Clang 15.0.0 (clang-1500.3.9.4)] on darwin Type "help", "copyright", "credits" or "license" for more information. warning: can't use pyrepl: terminal doesn't have the required clear capability >>> quit() Exception ignored in atexit callback <function register_readline.<locals>.write_history at 0x103b57a10>: Traceback (most recent call last): File "/Users/eugene/src/cpython/Lib/site.py", line 531, in write_history _pyrepl.readline.write_history_file(history) File "/Users/eugene/src/cpython/Lib/_pyrepl/readline.py", line 364, in write_history_file history = self.get_reader().get_trimmed_history(maxlength) File "/Users/eugene/src/cpython/Lib/_pyrepl/readline.py", line 280, in get_reader console = UnixConsole(self.f_in, self.f_out, encoding=ENCODING) File "/Users/eugene/src/cpython/Lib/_pyrepl/unix_console.py", line 180, in __init__ self._clear = _my_getstr("clear") File "/Users/eugene/src/cpython/Lib/_pyrepl/unix_console.py", line 173, in _my_getstr raise InvalidTerminal( _pyrepl.unix_console.InvalidTerminal: terminal doesn't have the required clear capabilityTODO: The test needs a little bit of tweaking still.