Skip to content

Commit

Permalink
[3.13] gh-119102: Fix REPL for dumb terminal (GH-119269) (#119308)
Browse files Browse the repository at this point in the history
gh-119102: Fix REPL for dumb terminal (GH-119269)

Use CAN_USE_PYREPL of _pyrepl.__main__ in the site module to decide
if _pyrepl.write_history_file() can be used.
(cherry picked from commit 73f4a58)

Co-authored-by: Victor Stinner <vstinner@python.org>
  • Loading branch information
miss-islington and vstinner authored May 21, 2024
1 parent 49ad4d0 commit f028451
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 f028451

Please sign in to comment.