summaryrefslogtreecommitdiffstats
path: root/Lib/site.py
diff options
context:
space:
mode:
authorVictor Stinner <vstinner@python.org>2024-05-21 12:53:20 (GMT)
committerGitHub <noreply@github.com>2024-05-21 12:53:20 (GMT)
commit73f4a58d36b65ec650e8f00b2affc4a4d3195f0c (patch)
tree3232169a76a3218afb64ad46d7490823bc27802d /Lib/site.py
parentb36533290608aed757f6eb16869a679650d32e17 (diff)
downloadcpython-73f4a58d36b65ec650e8f00b2affc4a4d3195f0c.zip
cpython-73f4a58d36b65ec650e8f00b2affc4a4d3195f0c.tar.gz
cpython-73f4a58d36b65ec650e8f00b2affc4a4d3195f0c.tar.bz2
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.
Diffstat (limited to 'Lib/site.py')
-rw-r--r--Lib/site.py3
1 files changed, 2 insertions, 1 deletions
diff --git a/Lib/site.py b/Lib/site.py
index b63447d..4ba0783 100644
--- a/Lib/site.py
+++ b/Lib/site.py
@@ -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)