From 1817d2116a3b2b9f5239b25b87657a324695fb5a Mon Sep 17 00:00:00 2001 From: Andrey Dorozhkin Date: Tue, 2 Jun 2020 16:43:07 +0300 Subject: [PATCH] Disable defining (v)snprintf as macro in modern Visual Studio --- include/pybind11/detail/common.h | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/include/pybind11/detail/common.h b/include/pybind11/detail/common.h index dd6267936..fb7c22f60 100644 --- a/include/pybind11/detail/common.h +++ b/include/pybind11/detail/common.h @@ -96,6 +96,12 @@ #define PYBIND11_VERSION_MINOR 5 #define PYBIND11_VERSION_PATCH dev1 +/* Don't let Python.h #define (v)snprintf as macro because they are implemented + properly in Visual Studio since 2015. */ +#if defined(_MSC_VER) && _MSC_VER >= 1900 +# define HAVE_SNPRINTF 1 +#endif + /// Include Python header, disable linking to pythonX_d.lib on Windows in debug mode #if defined(_MSC_VER) # if (PY_MAJOR_VERSION == 3 && PY_MINOR_VERSION < 4)