Skip to content

Commit b67a64d

Browse files
authored
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.
1 parent eb6d0e0 commit b67a64d

File tree

3 files changed

+5
-4
lines changed

3 files changed

+5
-4
lines changed

Lib/test/test_cext/setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,7 @@ def main():
118118
print(f"Add PCbuild directory: {pcbuild}")
119119

120120
# Display information to help debugging
121-
for env_name in ('CC', 'CFLAGS'):
121+
for env_name in ('CC', 'CFLAGS', 'CPPFLAGS'):
122122
if env_name in os.environ:
123123
print(f"{env_name} env var: {os.environ[env_name]!r}")
124124
else:

Lib/test/test_cppext/extension.cpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,9 @@
1616
#ifdef TEST_INTERNAL_C_API
1717
// gh-135906: Check for compiler warnings in the internal C API
1818
# include "internal/pycore_frame.h"
19-
// mimalloc emits compiler warnings when Python is built on Windows.
20-
# if !defined(MS_WINDOWS)
19+
// mimalloc emits compiler warnings when Python is built on Windows
20+
// and macOS.
21+
# if !defined(MS_WINDOWS) && !defined(__APPLE__)
2122
# include "internal/pycore_backoff.h"
2223
# include "internal/pycore_cell.h"
2324
# endif

Lib/test/test_cppext/setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@ def main():
101101
print(f"Add PCbuild directory: {pcbuild}")
102102

103103
# Display information to help debugging
104-
for env_name in ('CC', 'CFLAGS', 'CPPFLAGS'):
104+
for env_name in ('CC', 'CXX', 'CFLAGS', 'CPPFLAGS', 'CXXFLAGS'):
105105
if env_name in os.environ:
106106
print(f"{env_name} env var: {os.environ[env_name]!r}")
107107
else:

0 commit comments

Comments
 (0)