summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMiss Islington (bot) <31488909+miss-islington@users.noreply.github.com>2022-06-16 13:17:35 (GMT)
committerGitHub <noreply@github.com>2022-06-16 13:17:35 (GMT)
commit62f72e481183c89f94aa3d8e30c6d453db490561 (patch)
treea8048d27959f15667eff53b63fe28469d9599c92
parentdf091e14d8c5b25b9094ebb86857e30adc8e5abb (diff)
downloadcpython-62f72e481183c89f94aa3d8e30c6d453db490561.zip
cpython-62f72e481183c89f94aa3d8e30c6d453db490561.tar.gz
cpython-62f72e481183c89f94aa3d8e30c6d453db490561.tar.bz2
gh-91321: Fix test_cppext for C++03 (GH-93902) (#93904)
Don't build _testcppext.cpp with -Wzero-as-null-pointer-constant when testing C++03: only use this compiler flag with C++11. (cherry picked from commit a38c2a61d585fce0973e93dd590551ccddd947fb) Co-authored-by: Victor Stinner <vstinner@python.org> Co-authored-by: Victor Stinner <vstinner@python.org>
-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 a288dbd..892e24a 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],