26
26
# The workaround for Python environments using libedit is to install the gnureadline Python library.
27
27
#########################################################################################################################
28
28
29
- # Prefer statically linked gnureadline if available due to issues with libedit
29
+ # Prefer statically linked gnureadline if installed due to compatibility issues with libedit
30
30
try :
31
31
# noinspection PyPackageRequirements
32
32
import gnureadline as readline # type: ignore[import]
33
33
except ImportError :
34
- # Try to import readline, but allow failure for convenience in Windows unit testing.
35
- # Note: If this actually fails, you should install gnureadline on Linux/Mac or pyreadline on Windows.
34
+ # Note: If this actually fails, you should install gnureadline on Linux/Mac or pyreadline3 on Windows.
36
35
try :
37
36
# noinspection PyUnresolvedReferences
38
37
import readline # type: ignore[no-redef]
@@ -57,8 +56,8 @@ class RlType(Enum):
57
56
# Explanation for why Readline wasn't loaded
58
57
_rl_warn_reason = ''
59
58
60
- # The order of this check matters since importing pyreadline/ pyreadline3 will also show readline in the modules list
61
- if 'pyreadline' in sys . modules or ' pyreadline3' in sys .modules :
59
+ # The order of this check matters since importing pyreadline3 will also show readline in the modules list
60
+ if 'pyreadline3' in sys .modules :
62
61
rl_type = RlType .PYREADLINE
63
62
64
63
import atexit
@@ -109,7 +108,7 @@ def enable_win_vt100(handle: HANDLE) -> bool:
109
108
vt100_support = vt100_stdout_support and vt100_stderr_support
110
109
111
110
############################################################################################################
112
- # pyreadline is incomplete in terms of the Python readline API. Add the missing functions we need.
111
+ # pyreadline3 is incomplete in terms of the Python readline API. Add the missing functions we need.
113
112
############################################################################################################
114
113
# readline.redisplay()
115
114
try :
@@ -125,7 +124,7 @@ def enable_win_vt100(handle: HANDLE) -> bool:
125
124
# noinspection PyProtectedMember,PyUnresolvedReferences
126
125
def pyreadline_remove_history_item (pos : int ) -> None :
127
126
"""
128
- An implementation of remove_history_item() for pyreadline
127
+ An implementation of remove_history_item() for pyreadline3
129
128
:param pos: The 0-based position in history to remove
130
129
"""
131
130
# Save of the current location of the history cursor
@@ -162,7 +161,7 @@ def pyreadline_remove_history_item(pos: int) -> None:
162
161
if not _rl_warn_reason :
163
162
_rl_warn_reason = (
164
163
"no supported version of readline was found. To resolve this, install\n "
165
- "pyreadline on Windows or gnureadline on Linux/Mac."
164
+ "pyreadline3 on Windows or gnureadline on Linux/Mac."
166
165
)
167
166
rl_warning = "Readline features including tab completion have been disabled because\n " + _rl_warn_reason + '\n \n '
168
167
else :
0 commit comments