From: Victor Stinner Date: Tue, 10 Feb 2026 19:31:12 +0000 (+0100) Subject: gh-141563: Fix test_cppext on macOS (#144685) X-Git-Tag: v3.15.0a6~5 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=b67a64d7e277b6ab7b4d77e12f35c58b64f55e65;p=thirdparty%2FPython%2Fcpython.git gh-141563: Fix test_cppext on macOS (#144685) Don't test internal header files including mimalloc on macOS since mimalloc emits compiler warnings: In file included from extension.cpp:21: In file included from Include/internal/pycore_backoff.h:15: In file included from Include/internal/pycore_interp_structs.h:15: In file included from Include/internal/pycore_tstate.h:14: In file included from Include/internal/pycore_mimalloc.h:43: Include/internal/mimalloc/mimalloc.h:464:85: error: defaulted function definitions are a C++11 extension [-Werror,-Wc++11-extensions] mi_stl_allocator() mi_attr_noexcept = default; ^ Include/internal/mimalloc/mimalloc.h:465:85: error: defaulted function definitions are a C++11 extension [-Werror,-Wc++11-extensions] mi_stl_allocator(const mi_stl_allocator&) mi_attr_noexcept = default; Log also CXX and CXXFLAGS env vars in test_cppext. Log also CPPFLAGS in test_cext. --- diff --git a/Lib/test/test_cext/setup.py b/Lib/test/test_cext/setup.py index 67dfddec7517..db43f6fb17a1 100644 --- a/Lib/test/test_cext/setup.py +++ b/Lib/test/test_cext/setup.py @@ -118,7 +118,7 @@ def main(): print(f"Add PCbuild directory: {pcbuild}") # Display information to help debugging - for env_name in ('CC', 'CFLAGS'): + for env_name in ('CC', 'CFLAGS', 'CPPFLAGS'): if env_name in os.environ: print(f"{env_name} env var: {os.environ[env_name]!r}") else: diff --git a/Lib/test/test_cppext/extension.cpp b/Lib/test/test_cppext/extension.cpp index 7d360f88fdd1..06ef997d57af 100644 --- a/Lib/test/test_cppext/extension.cpp +++ b/Lib/test/test_cppext/extension.cpp @@ -16,8 +16,9 @@ #ifdef TEST_INTERNAL_C_API // gh-135906: Check for compiler warnings in the internal C API # include "internal/pycore_frame.h" - // mimalloc emits compiler warnings when Python is built on Windows. -# if !defined(MS_WINDOWS) + // mimalloc emits compiler warnings when Python is built on Windows + // and macOS. +# if !defined(MS_WINDOWS) && !defined(__APPLE__) # include "internal/pycore_backoff.h" # include "internal/pycore_cell.h" # endif diff --git a/Lib/test/test_cppext/setup.py b/Lib/test/test_cppext/setup.py index 98442b106b61..a3eec1c67e15 100644 --- a/Lib/test/test_cppext/setup.py +++ b/Lib/test/test_cppext/setup.py @@ -101,7 +101,7 @@ def main(): print(f"Add PCbuild directory: {pcbuild}") # Display information to help debugging - for env_name in ('CC', 'CFLAGS', 'CPPFLAGS'): + for env_name in ('CC', 'CXX', 'CFLAGS', 'CPPFLAGS', 'CXXFLAGS'): if env_name in os.environ: print(f"{env_name} env var: {os.environ[env_name]!r}") else: