Issue #28768: Fix implicit declaration of function _setmode. Patch by Masayuki Yamamoto
diff --git a/Modules/_io/fileio.c b/Modules/_io/fileio.c
index 0678ef8..4a71a57 100644
--- a/Modules/_io/fileio.c
+++ b/Modules/_io/fileio.c
@@ -8,6 +8,9 @@
 #ifdef HAVE_SYS_STAT_H
 #include <sys/stat.h>
 #endif
+#ifdef HAVE_IO_H
+#include <io.h>
+#endif
 #ifdef HAVE_FCNTL_H
 #include <fcntl.h>
 #endif
diff --git a/Modules/main.c b/Modules/main.c
index 44217c6..73e87e0 100644
--- a/Modules/main.c
+++ b/Modules/main.c
@@ -10,6 +10,9 @@
 #endif
 
 #if defined(MS_WINDOWS) || defined(__CYGWIN__)
+#ifdef HAVE_IO_H
+#include <io.h>
+#endif
 #ifdef HAVE_FCNTL_H
 #include <fcntl.h>
 #endif