From 67112c56557693d5a4dc87e6796c05677d3ecdab Mon Sep 17 00:00:00 2001
From: Alexey Pavlov <alexpux@gmail.com>
Date: Thu, 28 Aug 2025 12:13:10 +0300
Subject: [PATCH 119/N] Add MINGW to version string

---
 Python/getcompiler.c | 56 +++++++++++++++++++++++++-------------------
 1 file changed, 32 insertions(+), 24 deletions(-)

diff --git a/Python/getcompiler.c b/Python/getcompiler.c
index dd4d3c8..16d7055 100644
--- a/Python/getcompiler.c
+++ b/Python/getcompiler.c
@@ -15,37 +15,45 @@
    (such as NumPy) add "32 bit" or "64 bit (AMD64)" on Windows
    and also use a space as a separator rather than a newline. */
 #if defined(_WIN32)
-#define COMP_SEP " "
-#if defined(__x86_64__)
-#define ARCH_SUFFIX " 64 bit (AMD64)"
-#elif defined(__aarch64__)
-#define ARCH_SUFFIX " 64 bit (ARM64)"
-#elif defined(__arm__)
-#define ARCH_SUFFIX " 32 bit (ARM)"
+#  define COMP_SEP " "
+#  if defined(__x86_64__)
+#    define ARCH_SUFFIX " 64 bit (AMD64)"
+#  elif defined(__aarch64__)
+#    define ARCH_SUFFIX " 64 bit (ARM64)"
+#  elif defined(__arm__)
+#    define ARCH_SUFFIX " 32 bit (ARM)"
+#  else
+#    define ARCH_SUFFIX " 32 bit"
+#  endif
 #else
-#define ARCH_SUFFIX " 32 bit"
+#  define COMP_SEP "\n"
+#  define ARCH_SUFFIX ""
 #endif
+
+#if defined __MINGW32__
+#  define ARCH_PREFIX "MINGW "
 #else
-#define COMP_SEP "\n"
-#define ARCH_SUFFIX ""
+#  define ARCH_PREFIX ""
 #endif
+
 #if defined(__clang__)
-#define str(x) #x
-#define xstr(x) str(x)
-#if defined(_UCRT)
-#define COMPILER COMP_SEP "[GCC UCRT Clang " xstr(__clang_major__) "." \
-        xstr(__clang_minor__) "." xstr(__clang_patchlevel__) ARCH_SUFFIX "]"
+#  define str(x) #x
+#  define xstr(x) str(x)
+#  if defined(_UCRT)
+#    define COMPILER COMP_SEP "[" ARCH_PREFIX "Clang UCRT " xstr(__clang_major__) "." \
+            xstr(__clang_minor__) "." xstr(__clang_patchlevel__) ARCH_SUFFIX "]"
+#  else
+#    define COMPILER COMP_SEP "[" ARCH_PREFIX "Clang " xstr(__clang_major__) "." \
+            xstr(__clang_minor__) "." xstr(__clang_patchlevel__) ARCH_SUFFIX "]"
+#  endif
 #else
-#define COMPILER COMP_SEP "[GCC Clang " xstr(__clang_major__) "." \
-        xstr(__clang_minor__) "." xstr(__clang_patchlevel__) ARCH_SUFFIX "]"
-#endif
-#else
-#if defined(_UCRT)
-#define COMPILER COMP_SEP "[GCC UCRT " __VERSION__ ARCH_SUFFIX "]"
-#else
-#define COMPILER COMP_SEP "[GCC " __VERSION__ ARCH_SUFFIX "]"
-#endif
+#  if defined(_UCRT)
+#    define COMPILER COMP_SEP "[" ARCH_PREFIX "GCC UCRT " __VERSION__ ARCH_SUFFIX "]"
+#  else
+#    define COMPILER COMP_SEP "[" ARCH_PREFIX "GCC " __VERSION__ ARCH_SUFFIX "]"
+#  endif
 #endif
+
 // Generic fallbacks.
 #elif defined(__cplusplus)
 #define COMPILER "[C++]"
