From ac9f7b023593f0fc7efece980a79a2f8cbcd559a Mon Sep 17 00:00:00 2001 From: Victor Stinner Date: Tue, 10 Feb 2026 19:36:15 +0100 Subject: [PATCH] gh-141563: Fix test_cppext on macOS 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. --- Lib/test/test_cext/setup.py | 2 +- Lib/test/test_cppext/extension.cpp | 5 +++-- Lib/test/test_cppext/setup.py | 2 +- 3 files changed, 5 insertions(+), 4 deletions(-) diff --git a/Lib/test/test_cext/setup.py b/Lib/test/test_cext/setup.py index 67dfddec751791..db43f6fb17a132 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 7d360f88fdd1f1..06ef997d57af46 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 98442b106b6113..a3eec1c67e1556 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: