From 2ef020968d626311b5bf65f69fefa99b9b81db50 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?St=C3=A9phane=20Wirtel?= Date: Mon, 18 Feb 2019 12:03:46 +0100 Subject: [PATCH 1/2] bpo-36020: Define std::snprintf only for the previous versions of MSVC++ 14.0 --- Include/pyerrors.h | 2 +- .../next/Windows/2019-02-18-12-02-32.bpo-36020.CGyW--.rst | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) create mode 100644 Misc/NEWS.d/next/Windows/2019-02-18-12-02-32.bpo-36020.CGyW--.rst diff --git a/Include/pyerrors.h b/Include/pyerrors.h index 5c6751868df489..6a279a45afdcd0 100644 --- a/Include/pyerrors.h +++ b/Include/pyerrors.h @@ -323,7 +323,7 @@ PyAPI_FUNC(int) PyUnicodeTranslateError_SetReason( not rely on any particular behavior; eventually the C99 defn may be reliable. */ -#if defined(MS_WIN32) && !defined(HAVE_SNPRINTF) +#if defined(MS_WIN32) && !defined(HAVE_SNPRINTF) && _MSC_VER < 1900 # define HAVE_SNPRINTF # define snprintf _snprintf # define vsnprintf _vsnprintf diff --git a/Misc/NEWS.d/next/Windows/2019-02-18-12-02-32.bpo-36020.CGyW--.rst b/Misc/NEWS.d/next/Windows/2019-02-18-12-02-32.bpo-36020.CGyW--.rst new file mode 100644 index 00000000000000..d8254f9a1ec19d --- /dev/null +++ b/Misc/NEWS.d/next/Windows/2019-02-18-12-02-32.bpo-36020.CGyW--.rst @@ -0,0 +1,2 @@ +Define snprintf in pyerrors.h for the previous versions of MSVC++ 14.0. +Patch by Stéphane Wirtel From dd578e5443971bed2dc3220b267e3ca0805c10c3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?St=C3=A9phane=20Wirtel?= Date: Mon, 18 Feb 2019 13:11:11 +0100 Subject: [PATCH 2/2] Check if _MSC_VER is defined --- Include/pyerrors.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Include/pyerrors.h b/Include/pyerrors.h index 6a279a45afdcd0..b0075bffa29d77 100644 --- a/Include/pyerrors.h +++ b/Include/pyerrors.h @@ -323,7 +323,8 @@ PyAPI_FUNC(int) PyUnicodeTranslateError_SetReason( not rely on any particular behavior; eventually the C99 defn may be reliable. */ -#if defined(MS_WIN32) && !defined(HAVE_SNPRINTF) && _MSC_VER < 1900 +#if defined(MS_WIN32) && !defined(HAVE_SNPRINTF) && \ + defined(_MSC_VER) && _MSC_VER < 1900 # define HAVE_SNPRINTF # define snprintf _snprintf # define vsnprintf _vsnprintf