Skip to content

Commit 7452e95

Browse files
[3.13] pythongh-131189: Fix "msvcrt" import warning on Linux when "_ctypes" is not available. (pythonGH-131201) (pythonGH-138934)
pythongh-131189: Fix "msvcrt" import warning on Linux when "_ctypes" is not available. (pythonGH-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. (cherry picked from commit f320c95) Co-authored-by: Dzmitry Plashchynski <[email protected]>
1 parent dbe5e39 commit 7452e95

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)