From 8b45fe5eaef6ba103949730740f4fe0308334752 Mon Sep 17 00:00:00 2001
From: "Joachim Wuttke (h)" <j.wuttke@fz-juelich.de>
Date: Wed, 1 May 2024 17:52:03 +0200
Subject: [PATCH] Fix size detection of numeric types (closes: #951)

---
 PyCore/Embed/PyInterpreter.cpp | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/PyCore/Embed/PyInterpreter.cpp b/PyCore/Embed/PyInterpreter.cpp
index 69a66fa0e8c..480a087e4db 100644
--- a/PyCore/Embed/PyInterpreter.cpp
+++ b/PyCore/Embed/PyInterpreter.cpp
@@ -422,12 +422,12 @@ std::vector<double> PyInterpreter::Numpy::createVectorFromArray2D(PyObject* pyob
 
 // prevent the error from Windows compiler MSVC 19:
 // `error C2196: case value 'NPY_LONG' already used`
-#ifndef _WIN32
+#if NPY_LONG != NPY_INT32
 
     case NPY_LONG:
         _realArray2DToDouble<npy_long>(npArray_ptr, rowIdxMax, colIdxMax, data);
         break;
-#endif // _WIN32
+#endif
 
     // unsigned int
     case NPY_UINT8:
@@ -442,11 +442,11 @@ std::vector<double> PyInterpreter::Numpy::createVectorFromArray2D(PyObject* pyob
 
 // prevent the error from Windows compiler MSVC 19:
 // `error C2196: case value 'NPY_ULONG' already used`
-#ifndef _WIN32
+#if NPY_ULONG != NPY_UINT32
     case NPY_ULONG:
         _realArray2DToDouble<npy_ulong>(npArray_ptr, rowIdxMax, colIdxMax, data);
         break;
-#endif // _WIN32
+#endif
 
     default:
         throw std::runtime_error(errorDescription("PyInterpreter::Numpy: "
-- 
GitLab