https://github.com/python/cpython/commit/ba935775f31b841f4eaa39095051f1a25aaad959
commit: ba935775f31b841f4eaa39095051f1a25aaad959
branch: main
author: Victor Stinner <[email protected]>
committer: vstinner <[email protected]>
date: 2026-11-14T01:49:07+01:00
summary:
Log Py_LIMITED_API and Py_TARGET_ABI3T in test_cext (#161958)
files:
M Lib/test/test_cext/extension.c
M Lib/test/test_cext/runtests.py
diff --git a/Lib/test/test_cext/extension.c b/Lib/test/test_cext/extension.c
index 65dd25d71f494b..b462a949bd9899 100644
--- a/Lib/test/test_cext/extension.c
+++ b/Lib/test/test_cext/extension.c
@@ -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;
diff --git a/Lib/test/test_cext/runtests.py b/Lib/test/test_cext/runtests.py
index 6700b410b7d7a7..cb2725209de7dc 100644
--- a/Lib/test/test_cext/runtests.py
+++ b/Lib/test/test_cext/runtests.py
@@ -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()
_______________________________________________
Python-checkins mailing list -- [email protected]
To unsubscribe send an email to [email protected]
https://mail.python.org/mailman3//lists/python-checkins.python.org
Member address: [email protected]