diff -rupN --no-dereference Python-3.10.9/Python/pylifecycle.c Python-3.10.9-new/Python/pylifecycle.c --- Python-3.10.9/Python/pylifecycle.c 2022-12-06 19:31:21.000000000 +0100 +++ Python-3.10.9-new/Python/pylifecycle.c 2022-12-08 09:36:55.417024773 +0100 @@ -41,6 +41,26 @@ #define PUTS(fd, str) _Py_write_noraise(fd, str, (int)strlen(str)) +#if defined(__MINGW32__) && defined(PY_COERCE_C_LOCALE) +static int +setenv (const char *var, const char *val, int ovr) +{ + BOOL b; + char c[2]; + if (!ovr) + { + DWORD d; + d = GetEnvironmentVariableA (var, c, 2); + if (0 != d && GetLastError () != ERROR_ENVVAR_NOT_FOUND) + return 1; + } + b = SetEnvironmentVariableA (var, val); + if (b) + return 0; + return 1; +} +#endif + _Py_IDENTIFIER(flush); _Py_IDENTIFIER(name); _Py_IDENTIFIER(stdin);