]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
gh-141563: Fix test_cppext on macOS (#144685)
authorVictor Stinner <vstinner@python.org>
Tue, 10 Feb 2026 19:31:12 +0000 (20:31 +0100)
committerGitHub <noreply@github.com>
Tue, 10 Feb 2026 19:31:12 +0000 (20:31 +0100)
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
Lib/test/test_cppext/extension.cpp
Lib/test/test_cppext/setup.py

index 67dfddec751791a27694b77513ad5fbfe9ef4137..db43f6fb17a132e5caf492f2c2a651b0c90992d4 100644 (file)
@@ -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:
index 7d360f88fdd1f11bd41366bfb985f5c7749cd3b8..06ef997d57af463888e275897858172eac2dc475 100644 (file)
@@ -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
index 98442b106b611335389cbb9ff4e2cfcda8327e8c..a3eec1c67e1556e0bd7f72744f791917f62d03fc 100644 (file)
@@ -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: