Skip to content

Commit 37dc157

Browse files
committed
gh-119102: Fix REPL for dumb terminal
Use CAN_USE_PYREPL of _pyrepl.__main__ in the site module to decide if _pyrepl.write_history_file() can be used.
1 parent 9257731 commit 37dc157

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

Lib/site.py

Lines changed: 2 additions & 1 deletion
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)