gh-127906: Test the limited C API in test_cppext (#127916)

This commit is contained in:
Victor Stinner 2024-12-13 14:23:20 +01:00 committed by GitHub
parent 6ff38fc4e2
commit d05a4e6a0d
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 26 additions and 3 deletions

View file

@ -33,6 +33,7 @@ def main():
cppflags = list(CPPFLAGS)
std = os.environ.get("CPYTHON_TEST_CPP_STD", "")
module_name = os.environ["CPYTHON_TEST_EXT_NAME"]
limited = bool(os.environ.get("CPYTHON_TEST_LIMITED", ""))
cppflags = list(CPPFLAGS)
cppflags.append(f'-DMODULE_NAME={module_name}')
@ -59,6 +60,11 @@ def main():
# CC env var overrides sysconfig CC variable in setuptools
os.environ['CC'] = cmd
# Define Py_LIMITED_API macro
if limited:
version = sys.hexversion
cppflags.append(f'-DPy_LIMITED_API={version:#x}')
# On Windows, add PCbuild\amd64\ to include and library directories
include_dirs = []
library_dirs = []