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.
This commit is contained in:
committed by
GitHub
parent
e4654e0b3e
commit
f320c951c3
@@ -43,10 +43,11 @@ from ._module_completer import ModuleCompleter, make_default_module_completer
|
|||||||
|
|
||||||
Console: type[ConsoleType]
|
Console: type[ConsoleType]
|
||||||
_error: tuple[type[Exception], ...] | type[Exception]
|
_error: tuple[type[Exception], ...] | type[Exception]
|
||||||
try:
|
|
||||||
from .unix_console import UnixConsole as Console, _error
|
if os.name == "nt":
|
||||||
except ImportError:
|
|
||||||
from .windows_console import WindowsConsole as Console, _error
|
from .windows_console import WindowsConsole as Console, _error
|
||||||
|
else:
|
||||||
|
from .unix_console import UnixConsole as Console, _error
|
||||||
|
|
||||||
ENCODING = sys.getdefaultencoding() or "latin1"
|
ENCODING = sys.getdefaultencoding() or "latin1"
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user