import shlex
import shutil
import subprocess
+import sys
import unittest
from test import support
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:
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)
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()
#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
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)