https://github.com/python/cpython/commit/7452e95d09e92b00d514cb098680d0c4b80dc5a1
commit: 7452e95d09e92b00d514cb098680d0c4b80dc5a1
branch: 3.13
author: Miss Islington (bot) <[email protected]>
committer: ambv <[email protected]>
date: 2025-09-15T18:29:33+02:00
summary:

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

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.
(cherry picked from commit f320c951c3220aa6727b581216463e8b3f8bcd6b)

Co-authored-by: Dzmitry Plashchynski <[email protected]>

files:
M Lib/_pyrepl/readline.py

diff --git a/Lib/_pyrepl/readline.py b/Lib/_pyrepl/readline.py
index be229488e54e37..f802a9526909e7 100644
--- a/Lib/_pyrepl/readline.py
+++ b/Lib/_pyrepl/readline.py
@@ -42,10 +42,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]

Reply via email to