summaryrefslogtreecommitdiffstats
path: root/Lib
diff options
context:
space:
mode:
authorMiss Islington (bot) <31488909+miss-islington@users.noreply.github.com>2024-05-21 13:46:11 (GMT)
committerGitHub <noreply@github.com>2024-05-21 13:46:11 (GMT)
commitf028451d95d5a8bda0ca1726b05c87a2caace025 (patch)
treea3ca2bedd779c6553ea9f2e7d16bd36eaf8c021d /Lib
parent49ad4d077ff0297ca7e04ac20102d4068351cae7 (diff)
downloadcpython-f028451d95d5a8bda0ca1726b05c87a2caace025.zip
cpython-f028451d95d5a8bda0ca1726b05c87a2caace025.tar.gz
cpython-f028451d95d5a8bda0ca1726b05c87a2caace025.tar.bz2
[3.13] gh-119102: Fix REPL for dumb terminal (GH-119269) (#119308)
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 73f4a58d36b65ec650e8f00b2affc4a4d3195f0c) Co-authored-by: Victor Stinner <vstinner@python.org>
Diffstat (limited to 'Lib')
-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)