Skip to content

Commit a38c2a6

Browse files
authored
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.
1 parent 7546914 commit a38c2a6

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

Lib/test/setup_testcppext.py

+4-2
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,6 @@
1919
'-Werror',
2020
# Warn on old-style cast (C cast) like: (PyObject*)op
2121
'-Wold-style-cast',
22-
# Warn when using NULL rather than _Py_NULL in static inline functions
23-
'-Wzero-as-null-pointer-constant',
2422
]
2523
else:
2624
# Don't pass any compiler flag to MSVC
@@ -39,6 +37,10 @@ def main():
3937
name = '_testcpp11ext'
4038

4139
cppflags = [*CPPFLAGS, f'-std={std}']
40+
if std == 'c++11':
41+
# Warn when using NULL rather than _Py_NULL in static inline functions
42+
cppflags.append('-Wzero-as-null-pointer-constant')
43+
4244
cpp_ext = Extension(
4345
name,
4446
sources=[SOURCE],

0 commit comments

Comments
 (0)