https://github.com/python/cpython/commit/c6e418d1744aed95a6f25d22565204649dde29c7
commit: c6e418d1744aed95a6f25d22565204649dde29c7
branch: main
author: Victor Stinner <[email protected]>
committer: vstinner <[email protected]>
date: 2026-02-11T18:38:23+01:00
summary:
gh-141563: Enable test_cppext internal C API tests on macOS (#144711)
Build the C API in C++11 mode on macOS.
files:
M Lib/test/test_cppext/__init__.py
M Lib/test/test_cppext/extension.cpp
M Lib/test/test_cppext/setup.py
diff --git a/Lib/test/test_cppext/__init__.py b/Lib/test/test_cppext/__init__.py
index 9013503995bdce..1fd01702f64029 100644
--- a/Lib/test/test_cppext/__init__.py
+++ b/Lib/test/test_cppext/__init__.py
@@ -4,6 +4,7 @@
import shlex
import shutil
import subprocess
+import sys
import unittest
from test import support
@@ -27,9 +28,6 @@
class BaseTests:
TEST_INTERNAL_C_API = False
- def test_build(self):
- self.check_build('_testcppext')
-
def check_build(self, extension_name, std=None, limited=False):
venv_dir = 'env'
with support.setup_venv_with_pip_setuptools(venv_dir) as python_exe:
@@ -91,6 +89,9 @@ def run_cmd(operation, cmd):
class TestPublicCAPI(BaseTests, unittest.TestCase):
+ def test_build(self):
+ self.check_build('_testcppext')
+
@support.requires_gil_enabled('incompatible with Free Threading')
def test_build_limited_cpp03(self):
self.check_build('_test_limited_cpp03ext', std='c++03', limited=True)
@@ -119,6 +120,13 @@ def test_build_cpp14(self):
class TestInteralCAPI(BaseTests, unittest.TestCase):
TEST_INTERNAL_C_API = True
+ def test_build(self):
+ kwargs = {}
+ if sys.platform == 'darwin':
+ # Old Apple clang++ default C++ std is gnu++98
+ kwargs['std'] = 'c++11'
+ self.check_build('_testcppext_internal', **kwargs)
+
if __name__ == "__main__":
unittest.main()
diff --git a/Lib/test/test_cppext/extension.cpp
b/Lib/test/test_cppext/extension.cpp
index 06ef997d57af46..92c4645039a03b 100644
--- a/Lib/test/test_cppext/extension.cpp
+++ b/Lib/test/test_cppext/extension.cpp
@@ -16,9 +16,8 @@
#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
- // and macOS.
-# if !defined(MS_WINDOWS) && !defined(__APPLE__)
+ // mimalloc emits compiler warnings on Windows.
+# if !defined(MS_WINDOWS)
# 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 a3eec1c67e1556..2d9052a6b879da 100644
--- a/Lib/test/test_cppext/setup.py
+++ b/Lib/test/test_cppext/setup.py
@@ -59,7 +59,7 @@ def main():
else:
cppflags.append(f'-std={std}')
- if limited or (std != 'c++03'):
+ if limited or (std != 'c++03') and not internal:
# See CPPFLAGS_PEDANTIC docstring
cppflags.extend(CPPFLAGS_PEDANTIC)
_______________________________________________
Python-checkins mailing list -- [email protected]
To unsubscribe send an email to [email protected]
https://mail.python.org/mailman3//lists/python-checkins.python.org
Member address: [email protected]