Skip to content

Commit 56364ce

Browse files
committed
Fix "msvcrt" import warning on Linux when "_ctypes" is not available.
On Linux, compiling without "libffi" causes a "No module named 'msvcrt'" warning when launching PyREPL.
1 parent c5abded commit 56364ce

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

Lib/_pyrepl/readline.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -42,10 +42,11 @@
4242

4343
Console: type[ConsoleType]
4444
_error: tuple[type[Exception], ...] | type[Exception]
45-
try:
46-
from .unix_console import UnixConsole as Console, _error
47-
except ImportError:
45+
46+
if os.name == "nt":
4847
from .windows_console import WindowsConsole as Console, _error
48+
else:
49+
from .unix_console import UnixConsole as Console, _error
4950

5051
ENCODING = sys.getdefaultencoding() or "latin1"
5152

0 commit comments

Comments
 (0)