Skip to content

Commit

Permalink
Refactor import of _pyrepl.readline so test_python_basic_repl passes.
Browse files Browse the repository at this point in the history
  • Loading branch information
devdanzin committed Oct 9, 2024
1 parent bef3c7c commit 0a5699d
Showing 1 changed file with 15 additions and 13 deletions.
28 changes: 15 additions & 13 deletions Lib/site.py
Original file line number Diff line number Diff line change
Expand Up @@ -497,25 +497,27 @@ def register_readline():
PYTHON_BASIC_REPL = False

import atexit
if PYTHON_BASIC_REPL:
CAN_USE_PYREPL = False
else:
from _pyrepl.main import CAN_USE_PYREPL
try:
try:
try:
import readline
import readline
real_readline = True
except ImportError:
import _pyrepl.readline as readline
real_readline = False
import rlcompleter # noqa: F401
if PYTHON_BASIC_REPL:
CAN_USE_PYREPL = False
else:
from _pyrepl.main import CAN_USE_PYREPL
if real_readline:
import _pyrepl.unix_console
console_error = _pyrepl.unix_console._error
real_readline = True
except ImportError:
import _pyrepl.readline as readline
else:
import _pyrepl.windows_console
console_error = [_pyrepl.windows_console._error]
real_readline = False
import rlcompleter # noqa: F401

except ImportError:
return
except ImportError:
return

# Reading the initialization (config) file may not be enough to set a
# completion key, so we set one first and then read the file.
Expand Down

0 comments on commit 0a5699d

Please sign in to comment.