]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
[3.14] gh-137058: Sync _Py_NULL macro with the main branch (#137409)
authorVictor Stinner <vstinner@python.org>
Tue, 7 Oct 2025 16:41:45 +0000 (18:41 +0200)
committerGitHub <noreply@github.com>
Tue, 7 Oct 2025 16:41:45 +0000 (18:41 +0200)
gh-137058: Sync _Py_NULL macro with the main branch

* use __STDC_VERSION__ >= 202311L instead of
  __STDC_VERSION__ > 201710L.
* Check for _MSC_VER.

Include/pyport.h

index 3eac119bf8e8d89d6f38d6ffa32221d51959ace4..44894419f6231d89f166069a80f1548f4cf15b24 100644 (file)
@@ -49,8 +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 (__STDC_VERSION__) && __STDC_VERSION__ > 201710L) \
-        || (defined(__cplusplus) && __cplusplus >= 201103)
+#if !defined(_MSC_VER) && \
+    ((defined (__STDC_VERSION__) && __STDC_VERSION__ >= 202311L) \
+        || (defined(__cplusplus) && __cplusplus >= 201103))
 #  define _Py_NULL nullptr
 #else
 #  define _Py_NULL NULL