Skip to content

Commit 1460cce

Browse files
authored
gh-133537: Avoid using console I/O in WinAPI partitions that don't support it (GH-133538)
1 parent 427f8c3 commit 1460cce

File tree

2 files changed

+5
-0
lines changed

2 files changed

+5
-0
lines changed
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Avoid using console I/O in WinAPI partitions that don’t support it

Modules/posixmodule.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16875,12 +16875,16 @@ static PyObject *
1687516875
os__supports_virtual_terminal_impl(PyObject *module)
1687616876
/*[clinic end generated code: output=bd0556a6d9d99fe6 input=0752c98e5d321542]*/
1687716877
{
16878+
#ifdef HAVE_WINDOWS_CONSOLE_IO
1687816879
DWORD mode = 0;
1687916880
HANDLE handle = GetStdHandle(STD_ERROR_HANDLE);
1688016881
if (!GetConsoleMode(handle, &mode)) {
1688116882
Py_RETURN_FALSE;
1688216883
}
1688316884
return PyBool_FromLong(mode & ENABLE_VIRTUAL_TERMINAL_PROCESSING);
16885+
#else
16886+
Py_RETURN_FALSE;
16887+
#endif /* HAVE_WINDOWS_CONSOLE_IO */
1688416888
}
1688516889
#endif
1688616890

0 commit comments

Comments
 (0)