https://github.com/python/cpython/commit/115477399bb962193026a3035ab07a1c0cd52f9f
commit: 115477399bb962193026a3035ab07a1c0cd52f9f
branch: 3.14
author: Miss Islington (bot) <31488909+miss-isling...@users.noreply.github.com>
committer: ambv <luk...@langa.pl>
date: 2025-07-15T10:12:45+02:00
summary:

[3.14] gh-131189: Fix "msvcrt" import warning on Linux when "_ctypes" is not 
available. (GH-131201) (GH-136668)

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 f320c951c3220aa6727b581216463e8b3f8bcd6b)

Co-authored-by: Dzmitry Plashchynski <plashchyn...@gmail.com>

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 -- python-checkins@python.org
To unsubscribe send an email to python-checkins-le...@python.org
https://mail.python.org/mailman3//lists/python-checkins.python.org
Member address: arch...@mail-archive.com

Reply via email to