diff options
Diffstat (limited to 'Lib/test/setup_testcppext.py')
-rw-r--r-- | Lib/test/setup_testcppext.py | 19 |
1 files changed, 14 insertions, 5 deletions
diff --git a/Lib/test/setup_testcppext.py b/Lib/test/setup_testcppext.py index 780cb7b..a288dbd 100644 --- a/Lib/test/setup_testcppext.py +++ b/Lib/test/setup_testcppext.py @@ -13,8 +13,6 @@ SOURCE = support.findfile('_testcppext.cpp') if not MS_WINDOWS: # C++ compiler flags for GCC and clang CPPFLAGS = [ - # Python currently targets C++11 - '-std=c++11', # gh-91321: The purpose of _testcppext extension is to check that building # a C++ extension using the Python C API does not emit C++ compiler # warnings @@ -30,12 +28,23 @@ else: def main(): + cppflags = list(CPPFLAGS) + if '-std=c++03' in sys.argv: + sys.argv.remove('-std=c++03') + std = 'c++03' + name = '_testcpp03ext' + else: + # Python currently targets C++11 + std = 'c++11' + name = '_testcpp11ext' + + cppflags = [*CPPFLAGS, f'-std={std}'] cpp_ext = Extension( - '_testcppext', + name, sources=[SOURCE], language='c++', - extra_compile_args=CPPFLAGS) - setup(name="_testcppext", ext_modules=[cpp_ext]) + extra_compile_args=cppflags) + setup(name=name, ext_modules=[cpp_ext]) if __name__ == "__main__": |