Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit de8f530

Browse filesBrowse files
authored
gh-119102: Fix REPL for dumb terminal (#119332)
The site module gets the __main__ module to get _pyrepl.__main__.
1 parent 561ff1f commit de8f530
Copy full SHA for de8f530

File tree

1 file changed

+6
-1
lines changed
Filter options

1 file changed

+6
-1
lines changed

‎Lib/site.py

Copy file name to clipboardExpand all lines: Lib/site.py
+6-1Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -523,7 +523,12 @@ def register_readline():
523523
pass
524524

525525
def write_history():
526-
from _pyrepl.__main__ import CAN_USE_PYREPL
526+
try:
527+
# _pyrepl.__main__ is executed as the __main__ module
528+
from __main__ import CAN_USE_PYREPL
529+
except ImportError:
530+
CAN_USE_PYREPL = False
531+
527532
try:
528533
if os.getenv("PYTHON_BASIC_REPL") or not CAN_USE_PYREPL:
529534
readline.write_history_file(history)

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.