From 8594d2c03dccd9731e9fc83a9fe6a19a3a090cb7 Mon Sep 17 00:00:00 2001 From: Victor Stinner Date: Thu, 26 Jun 2025 18:11:49 +0200 Subject: [PATCH] gh-135927: Check _MSC_VER to define _Py_NULL macro (#135987) --- Include/pyport.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Include/pyport.h b/Include/pyport.h index 73f071c41a6..0675294d5bc 100644 --- a/Include/pyport.h +++ b/Include/pyport.h @@ -49,9 +49,9 @@ // Static inline functions should use _Py_NULL rather than using directly NULL // to prevent C++ compiler warnings. On C23 and newer and on C++11 and newer, // _Py_NULL is defined as nullptr. -#if (defined(__GNUC__) || defined(__clang__)) && \ - (defined (__STDC_VERSION__) && __STDC_VERSION__ > 201710L) \ - || (defined(__cplusplus) && __cplusplus >= 201103) +#if !defined(_MSC_VER) && \ + ((defined (__STDC_VERSION__) && __STDC_VERSION__ > 201710L) \ + || (defined(__cplusplus) && __cplusplus >= 201103)) # define _Py_NULL nullptr #else # define _Py_NULL NULL