https://github.com/python/cpython/commit/73f4a58d36b65ec650e8f00b2affc4a4d3195f0c
commit: 73f4a58d36b65ec650e8f00b2affc4a4d3195f0c
branch: main
author: Victor Stinner <[email protected]>
committer: vstinner <[email protected]>
date: 2024-05-21T13:53:20+01:00
summary:

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.

files:
M Lib/site.py

diff --git a/Lib/site.py b/Lib/site.py
index b63447d6673f68..4ba078388a37b8 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)

_______________________________________________
Python-checkins mailing list -- [email protected]
To unsubscribe send an email to [email protected]
https://mail.python.org/mailman3/lists/python-checkins.python.org/
Member address: [email protected]

Reply via email to