Skip to content

Commit 1817d21

Browse files
Andrey Dorozhkinwjakob
Andrey Dorozhkin
authored andcommitted
Disable defining (v)snprintf as macro in modern Visual Studio
1 parent 4e3d9fe commit 1817d21

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

include/pybind11/detail/common.h

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,12 @@
9696
#define PYBIND11_VERSION_MINOR 5
9797
#define PYBIND11_VERSION_PATCH dev1
9898

99+
/* Don't let Python.h #define (v)snprintf as macro because they are implemented
100+
properly in Visual Studio since 2015. */
101+
#if defined(_MSC_VER) && _MSC_VER >= 1900
102+
# define HAVE_SNPRINTF 1
103+
#endif
104+
99105
/// Include Python header, disable linking to pythonX_d.lib on Windows in debug mode
100106
#if defined(_MSC_VER)
101107
# if (PY_MAJOR_VERSION == 3 && PY_MINOR_VERSION < 4)

0 commit comments

Comments
 (0)