diff --git a/build-scripts/extras/python/wrappython.h b/build-scripts/extras/python/wrappython.h index bfd2f93b0..b542beac9 100644 --- a/build-scripts/extras/python/wrappython.h +++ b/build-scripts/extras/python/wrappython.h @@ -31,6 +31,12 @@ #ifdef _DEBUG # ifndef MANTID_DEBUG_PYTHON +// Workaround for VS 2022 which doesn't like _DEBUG being messed with. Based on PyBind solution +// https://github.com/pybind/pybind11/pull/3497 +# include +# if _MSVC_STL_VERSION >= 143 +# include +# endif # undef _DEBUG // Don't let Python force the debug library just because we're debugging. # define DEBUG_UNDEFINED_FROM_WRAP_PYTHON_H # endif diff --git a/lib/python3.8/include/wrappython.h b/lib/python3.8/include/wrappython.h index bfd2f93b0..b542beac9 100644 --- a/lib/python3.8/include/wrappython.h +++ b/lib/python3.8/include/wrappython.h @@ -31,6 +31,12 @@ #ifdef _DEBUG # ifndef MANTID_DEBUG_PYTHON +// Workaround for VS 2022 which doesn't like _DEBUG being messed with. Based on PyBind solution +// https://github.com/pybind/pybind11/pull/3497 +# include +# if _MSVC_STL_VERSION >= 143 +# include +# endif # undef _DEBUG // Don't let Python force the debug library just because we're debugging. # define DEBUG_UNDEFINED_FROM_WRAP_PYTHON_H # endif