summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVictor Stinner <vstinner@python.org>2022-06-16 14:39:00 +0200
committerGitHub <noreply@github.com>2022-06-16 14:39:00 +0200
commita38c2a61d585fce0973e93dd590551ccddd947fb (patch)
treea1ae98332572e493b58cd150d14615c0a509fde5
parent7546914e3f8157d8bad2998677e0ea3ed4cb7939 (diff)
downloadcpython-git-a38c2a61d585fce0973e93dd590551ccddd947fb.tar.gz
gh-91321: Fix test_cppext for C++03 (#93902)
Don't build _testcppext.cpp with -Wzero-as-null-pointer-constant when testing C++03: only use this compiler flag with C++11.
-rw-r--r--Lib/test/setup_testcppext.py6
1 files changed, 4 insertions, 2 deletions
diff --git a/Lib/test/setup_testcppext.py b/Lib/test/setup_testcppext.py
index a288dbdc57..892e24a637 100644
--- a/Lib/test/setup_testcppext.py
+++ b/Lib/test/setup_testcppext.py
@@ -19,8 +19,6 @@ if not MS_WINDOWS:
'-Werror',
# Warn on old-style cast (C cast) like: (PyObject*)op
'-Wold-style-cast',
- # Warn when using NULL rather than _Py_NULL in static inline functions
- '-Wzero-as-null-pointer-constant',
]
else:
# Don't pass any compiler flag to MSVC
@@ -39,6 +37,10 @@ def main():
name = '_testcpp11ext'
cppflags = [*CPPFLAGS, f'-std={std}']
+ if std == 'c++11':
+ # Warn when using NULL rather than _Py_NULL in static inline functions
+ cppflags.append('-Wzero-as-null-pointer-constant')
+
cpp_ext = Extension(
name,
sources=[SOURCE],