diff -rupN --no-dereference Python-3.10.9/Modules/posixmodule.c Python-3.10.9-new/Modules/posixmodule.c --- Python-3.10.9/Modules/posixmodule.c 2022-12-08 09:36:57.114024811 +0100 +++ Python-3.10.9-new/Modules/posixmodule.c 2022-12-08 09:37:01.514024909 +0100 @@ -323,6 +323,26 @@ corresponding Unix manual entries for mo # define HAVE_CWAIT 1 # define HAVE_FSYNC 1 # define fsync _commit +#elif defined(__MINGW32__) /* GCC for windows hosts */ + /* getlogin is detected by configure on mingw-w64 */ +# undef HAVE_GETLOGIN + /*#define HAVE_GETCWD 1 - detected by configure*/ +# define HAVE_GETPPID 1 +# define HAVE_GETLOGIN 1 +# define HAVE_SPAWNV 1 +# define HAVE_WSPAWNV 1 +# define HAVE_WEXECV 1 + /*#define HAVE_EXECV 1 - detected by configure*/ +# define HAVE_PIPE 1 +# define HAVE_POPEN 1 +# define HAVE_SYSTEM 1 +# define HAVE_CWAIT 1 +# define HAVE_FSYNC 1 +# define fsync _commit +# include <winioctl.h> +# ifndef _MAX_ENV +# define _MAX_ENV 32767 +# endif # else /* Unix functions that the configure script doesn't check for */ # ifndef __VXWORKS__ @@ -423,7 +443,7 @@ extern char *ctermid_r(char *); # endif #endif -#ifdef _MSC_VER +#ifdef MS_WINDOWS # ifdef HAVE_DIRECT_H # include <direct.h> # endif @@ -1583,7 +1603,7 @@ win32_get_reparse_tag(HANDLE reparse_poi ** man environ(7). */ #include <crt_externs.h> -#elif !defined(_MSC_VER) && (!defined(__WATCOMC__) || defined(__QNX__) || defined(__VXWORKS__)) +#elif !defined(MS_WINDOWS) && (!defined(__WATCOMC__) || defined(__QNX__) || defined(__VXWORKS__)) extern char **environ; #endif /* !_MSC_VER */ @@ -4081,7 +4101,7 @@ _listdir_windows_no_opendir(path_t *path Py_END_ALLOW_THREADS /* FindNextFile sets error to ERROR_NO_MORE_FILES if it got to the end of the directory. */ - if (!result && GetLastError() != ERROR_NO_MORE_FILES) { + if (!result && GetLastError() != 0 && GetLastError() != ERROR_NO_MORE_FILES) { Py_DECREF(list); list = path_error(path); goto exit; diff -rupN --no-dereference Python-3.10.9/Modules/Setup Python-3.10.9-new/Modules/Setup --- Python-3.10.9/Modules/Setup 2022-12-08 09:37:01.508024909 +0100 +++ Python-3.10.9-new/Modules/Setup 2022-12-08 09:37:01.515024909 +0100 @@ -101,7 +101,7 @@ PYTHONPATH=$(COREPYTHONPATH) # This only contains the minimal set of modules required to run the # setup.py script in the root of the Python source tree. -posix -DPy_BUILD_CORE_BUILTIN -I$(srcdir)/Include/internal posixmodule.c # posix (UNIX) system calls +nt -DPy_BUILD_CORE posixmodule.c -lmincore # system calls errno errnomodule.c # posix (UNIX) errno values _sre -DPy_BUILD_CORE_BUILTIN _sre.c # Fredrik Lundh's new regular expressions _codecs _codecsmodule.c # access to the builtin codecs and codec registry