Skip to content

Commit f320c95

Browse files
authored
gh-131189: Fix "msvcrt" import warning on Linux when "_ctypes" is not available. (GH-131201)
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 e4654e0 commit f320c95

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
@@ -43,10 +43,11 @@
4343

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

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

0 commit comments

Comments
 (0)