Files
MINGW-packages/mingw-w64-python/0084-math-pyhash-MINGW-support.patch
2026-01-07 22:17:09 +01:00

46 lines
1.6 KiB
Diff

From fae0dd31a9ed86d398a349adcab75333fb7761c9 Mon Sep 17 00:00:00 2001
From: Alexey Pavlov <alexpux@gmail.com>
Date: Mon, 1 Sep 2025 13:26:35 +0300
Subject: [PATCH 084/N] math, pyhash: MINGW support
---
Modules/mathmodule.c | 4 ++--
Python/pyhash.c | 2 +-
2 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/Modules/mathmodule.c b/Modules/mathmodule.c
index aee1b17..08783f3 100644
--- a/Modules/mathmodule.c
+++ b/Modules/mathmodule.c
@@ -2166,7 +2166,7 @@ math_ldexp_impl(PyObject *module, double x, PyObject *i)
} else {
errno = 0;
r = ldexp(x, (int)exp);
-#ifdef _MSC_VER
+#ifdef _WIN32
if (DBL_MIN > r && r > -DBL_MIN) {
/* Denormal (or zero) results can be incorrectly rounded here (rather,
truncated). Fixed in newer versions of the C runtime, included
@@ -2404,7 +2404,7 @@ math_fmod_impl(PyObject *module, double x, double y)
return PyFloat_FromDouble(x);
errno = 0;
r = fmod(x, y);
-#ifdef _MSC_VER
+#ifdef _WIN32
/* Windows (e.g. Windows 10 with MSC v.1916) loose sign
for zero result. But C99+ says: "if y is nonzero, the result
has the same sign as x".
diff --git a/Python/pyhash.c b/Python/pyhash.c
index 5263622..ccf5258 100644
--- a/Python/pyhash.c
+++ b/Python/pyhash.c
@@ -215,7 +215,7 @@ PyHash_GetFuncDef(void)
}
/* Optimized memcpy() for Windows */
-#ifdef _MSC_VER
+#ifdef _WIN32
# if SIZEOF_PY_UHASH_T == 4
# define PY_UHASH_CPY(dst, src) do { \
dst[0] = src[0]; dst[1] = src[1]; dst[2] = src[2]; dst[3] = src[3]; \