mirror of https://github.com/python/cpython
gh-119102: Fix REPL for dumb terminal (#119332)
The site module gets the __main__ module to get _pyrepl.__main__.
This commit is contained in:
parent
561ff1fa71
commit
de8f530841
|
@ -523,7 +523,12 @@ def register_readline():
|
||||||
pass
|
pass
|
||||||
|
|
||||||
def write_history():
|
def write_history():
|
||||||
from _pyrepl.__main__ import CAN_USE_PYREPL
|
try:
|
||||||
|
# _pyrepl.__main__ is executed as the __main__ module
|
||||||
|
from __main__ import CAN_USE_PYREPL
|
||||||
|
except ImportError:
|
||||||
|
CAN_USE_PYREPL = False
|
||||||
|
|
||||||
try:
|
try:
|
||||||
if os.getenv("PYTHON_BASIC_REPL") or not CAN_USE_PYREPL:
|
if os.getenv("PYTHON_BASIC_REPL") or not CAN_USE_PYREPL:
|
||||||
readline.write_history_file(history)
|
readline.write_history_file(history)
|
||||||
|
|
Loading…
Reference in New Issue