https://github.com/python/cpython/commit/1460ccefd07f0d6d0e97409295796a5d5730a26e
commit: 1460ccefd07f0d6d0e97409295796a5d5730a26e
branch: main
author: Max Bachmann <kont...@maxbachmann.de>
committer: zooba <steve.do...@microsoft.com>
date: 2025-05-07T20:47:05+01:00
summary:

gh-133537: Avoid using console I/O in WinAPI partitions that don't support it 
(GH-133538)

files:
A Misc/NEWS.d/next/Windows/2025-05-07-08-19-15.gh-issue-133537.yzf963.rst
M Modules/posixmodule.c

diff --git 
a/Misc/NEWS.d/next/Windows/2025-05-07-08-19-15.gh-issue-133537.yzf963.rst 
b/Misc/NEWS.d/next/Windows/2025-05-07-08-19-15.gh-issue-133537.yzf963.rst
new file mode 100644
index 00000000000000..94e45f9d8ee741
--- /dev/null
+++ b/Misc/NEWS.d/next/Windows/2025-05-07-08-19-15.gh-issue-133537.yzf963.rst
@@ -0,0 +1 @@
+Avoid using console I/O in WinAPI partitions that don’t support it
diff --git a/Modules/posixmodule.c b/Modules/posixmodule.c
index 2bb5f387e44ef8..9cc0533f0dcfd1 100644
--- a/Modules/posixmodule.c
+++ b/Modules/posixmodule.c
@@ -16875,12 +16875,16 @@ static PyObject *
 os__supports_virtual_terminal_impl(PyObject *module)
 /*[clinic end generated code: output=bd0556a6d9d99fe6 input=0752c98e5d321542]*/
 {
+#ifdef HAVE_WINDOWS_CONSOLE_IO
     DWORD mode = 0;
     HANDLE handle = GetStdHandle(STD_ERROR_HANDLE);
     if (!GetConsoleMode(handle, &mode)) {
         Py_RETURN_FALSE;
     }
     return PyBool_FromLong(mode & ENABLE_VIRTUAL_TERMINAL_PROCESSING);
+#else
+    Py_RETURN_FALSE;
+#endif /* HAVE_WINDOWS_CONSOLE_IO */
 }
 #endif
 

_______________________________________________
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