Skip to content

Commit

Permalink
pythongh-91321: Fix test_cppext for C++03 (python#93902)
Browse files Browse the repository at this point in the history
Don't build _testcppext.cpp with -Wzero-as-null-pointer-constant when
testing C++03: only use this compiler flag with C++11.
  • Loading branch information
vstinner authored Jun 16, 2022
1 parent 7546914 commit a38c2a6
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions Lib/test/setup_testcppext.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,6 @@
'-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
Expand All @@ -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],
Expand Down

0 comments on commit a38c2a6

Please sign in to comment.