Skip to content

Commit ba93577

Browse files
authored
Log Py_LIMITED_API and Py_TARGET_ABI3T in test_cext (#161958)
1 parent f4fbacf commit ba93577

2 files changed

Lines changed: 21 additions & 4 deletions

File tree

‎Lib/test/test_cext/extension.c‎

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -483,6 +483,18 @@ module_exec(PyObject *module)
483483
return -1;
484484
}
485485
#endif
486+
487+
#ifdef Py_LIMITED_API
488+
if (PyModule_AddIntMacro(module, Py_LIMITED_API) < 0) {
489+
return -1;
490+
}
491+
#endif
492+
#ifdef Py_TARGET_ABI3T
493+
if (PyModule_AddIntMacro(module, Py_TARGET_ABI3T) < 0) {
494+
return -1;
495+
}
496+
#endif
497+
486498
// Ignore "unused argument" warning when none of these macros is defined
487499
(void)module;
488500
return 0;

‎Lib/test/test_cext/runtests.py‎

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -63,14 +63,19 @@ def main():
6363
'__STRICT_ANSI__',
6464
'__cplusplus',
6565
'_MSVC_LANG',
66+
'Py_LIMITED_API',
67+
'Py_TARGET_ABI3T',
6668
):
6769
try:
6870
value = getattr(testmod, name)
6971
except AttributeError:
70-
pass
71-
else:
72-
print(f'{name}: {value}')
73-
newline = True
72+
continue
73+
74+
if name in ('Py_LIMITED_API', 'Py_TARGET_ABI3T'):
75+
value = f'0x{value:08x}'
76+
77+
print(f'{name}: {value}')
78+
newline = True
7479
if newline:
7580
print()
7681

0 commit comments

Comments
 (0)