https://github.com/python/cpython/commit/f320c951c3220aa6727b581216463e8b3f8bcd6b
commit: f320c951c3220aa6727b581216463e8b3f8bcd6b
branch: main
author: Dzmitry Plashchynski <[email protected]>
committer: ambv <[email protected]>
date: 2025-07-15T09:44:31+02:00
summary:
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.
files:
M Lib/_pyrepl/readline.py
diff --git a/Lib/_pyrepl/readline.py b/Lib/_pyrepl/readline.py
index 9560ae779abfea..23b8fa6b9c7625 100644
--- a/Lib/_pyrepl/readline.py
+++ b/Lib/_pyrepl/readline.py
@@ -43,10 +43,11 @@
Console: type[ConsoleType]
_error: tuple[type[Exception], ...] | type[Exception]
-try:
- from .unix_console import UnixConsole as Console, _error
-except ImportError:
+
+if os.name == "nt":
from .windows_console import WindowsConsole as Console, _error
+else:
+ from .unix_console import UnixConsole as Console, _error
ENCODING = sys.getdefaultencoding() or "latin1"
_______________________________________________
Python-checkins mailing list -- [email protected]
To unsubscribe send an email to [email protected]
https://mail.python.org/mailman3//lists/python-checkins.python.org
Member address: [email protected]