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).
This commit is contained in:
William S Fulton 2022-09-09 05:55:54 +01:00
commit dcb2544a43

View file

@ -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