[3.12] gh-127906: Test the limited C API in test_cppext (GH-127916) (#127920)

gh-127906: Test the limited C API in test_cppext (GH-127916)
(cherry picked from commit d05a4e6a0d)

Co-authored-by: Victor Stinner <vstinner@python.org>
This commit is contained in:
Miss Islington (bot) 2024-12-13 15:14:20 +01:00 committed by GitHub
parent 5a658d85d5
commit 58916eb211
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 25 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 = []