summaryrefslogtreecommitdiff
path: root/Lib
diff options
context:
space:
mode:
authorWilliam S Fulton <wsf@fultondesigns.co.uk>2022-09-09 05:55:54 +0100
committerWilliam S Fulton <wsf@fultondesigns.co.uk>2022-09-09 19:03:40 +0100
commitdcb2544a439d446cf8fd309bec252b0616181328 (patch)
tree45d58c156f404ecc0bda4b6ade623ecb1b03c8ff /Lib
parent26c0a0c152bdb3dfa700c65244ad08406588fd65 (diff)
downloadswig-dcb2544a439d446cf8fd309bec252b0616181328.tar.gz
Visual C++ debug builds linking to Python release builds
Only use the corecrt.h workaround for #2090 when using SWIG_PYTHON_INTERPRETER_NO_DEBUG as the problem seems to only occur when undefining _DEBUG. Also extend workaround for Visual Studio 2019 version 16.10 and 16.11 as per #2174 (_MSC_VER=1929).
Diffstat (limited to 'Lib')
-rw-r--r--Lib/python/pyruntime.swg15
1 files changed, 8 insertions, 7 deletions
diff --git a/Lib/python/pyruntime.swg b/Lib/python/pyruntime.swg
index 74669a74f..eabc829c0 100644
--- a/Lib/python/pyruntime.swg
+++ b/Lib/python/pyruntime.swg
@@ -4,13 +4,6 @@
# include <math.h>
#endif
-#if defined(_MSC_VER) && _MSC_VER >= 1930
-/* Workaround what seems to be a bug in the Python headers with MSVC 2022.
- * https://github.com/swig/swig/issues/2090
- */
-# include <corecrt.h>
-#endif
-
#ifndef SWIG_NO_PY_SSIZE_T_CLEAN
#define PY_SSIZE_T_CLEAN
#endif
@@ -24,6 +17,14 @@
#if defined(_DEBUG) && defined(SWIG_PYTHON_INTERPRETER_NO_DEBUG)
/* Use debug wrappers with the Python release dll */
+
+#if defined(_MSC_VER) && _MSC_VER >= 1929
+/* Workaround what seems to be a bug in the Python headers with MSVC 2022.
+ * https://github.com/swig/swig/issues/2090
+ */
+# include <corecrt.h>
+#endif
+
# undef _DEBUG
# include <Python.h>
# define _DEBUG 1