Skip to content

Commit

Permalink
gh-119102: Fix REPL for dumb terminal (#119269)
Browse files Browse the repository at this point in the history
Use CAN_USE_PYREPL of _pyrepl.__main__ in the site module to decide
if _pyrepl.write_history_file() can be used.
  • Loading branch information
vstinner authored May 21, 2024
1 parent b365332 commit 73f4a58
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion Lib/site.py
Original file line number Diff line number Diff line change
Expand Up @@ -523,8 +523,9 @@ def register_readline():
pass

def write_history():
from _pyrepl.__main__ import CAN_USE_PYREPL
try:
if os.getenv("PYTHON_BASIC_REPL"):
if os.getenv("PYTHON_BASIC_REPL") or not CAN_USE_PYREPL:
readline.write_history_file(history)
else:
_pyrepl.readline.write_history_file(history)
Expand Down

0 comments on commit 73f4a58

Please sign in to comment.