Skip to content

Commit 73f4a58

Browse files
authored
gh-119102: Fix REPL for dumb terminal (#119269)
Use CAN_USE_PYREPL of _pyrepl.__main__ in the site module to decide if _pyrepl.write_history_file() can be used.
1 parent b365332 commit 73f4a58

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

Lib/site.py

+2-1
Original file line numberDiff line numberDiff line change
@@ -523,8 +523,9 @@ def register_readline():
523523
pass
524524

525525
def write_history():
526+
from _pyrepl.__main__ import CAN_USE_PYREPL
526527
try:
527-
if os.getenv("PYTHON_BASIC_REPL"):
528+
if os.getenv("PYTHON_BASIC_REPL") or not CAN_USE_PYREPL:
528529
readline.write_history_file(history)
529530
else:
530531
_pyrepl.readline.write_history_file(history)

0 commit comments

Comments
 (0)