Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions Lib/test/test_cext/extension.c
Original file line number Diff line number Diff line change
Expand Up @@ -483,6 +483,18 @@ module_exec(PyObject *module)
return -1;
}
#endif

#ifdef Py_LIMITED_API
if (PyModule_AddIntMacro(module, Py_LIMITED_API) < 0) {
return -1;
}
#endif
#ifdef Py_TARGET_ABI3T
if (PyModule_AddIntMacro(module, Py_TARGET_ABI3T) < 0) {
return -1;
}
#endif

// Ignore "unused argument" warning when none of these macros is defined
(void)module;
return 0;
Expand Down
13 changes: 9 additions & 4 deletions Lib/test/test_cext/runtests.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,14 +63,19 @@ def main():
'__STRICT_ANSI__',
'__cplusplus',
'_MSVC_LANG',
'Py_LIMITED_API',
'Py_TARGET_ABI3T',
):
try:
value = getattr(testmod, name)
except AttributeError:
pass
else:
print(f'{name}: {value}')
newline = True
continue

if name in ('Py_LIMITED_API', 'Py_TARGET_ABI3T'):
value = f'0x{value:08x}'

print(f'{name}: {value}')
newline = True
if newline:
print()

Expand Down
Loading