diff options
author | Victor Stinner <vstinner@python.org> | 2023-09-08 09:48:28 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-09-08 09:48:28 (GMT) |
commit | b0edf3b98e4b3e68a13776e034b9dd86ad7e529d (patch) | |
tree | 98e1b3a6fe21a9cd32d2143e4a85c74f57b2b007 /Lib/test/pythoninfo.py | |
parent | 15d4c9fabce67b8a1b5bd9dec9612014ec18291a (diff) | |
download | cpython-b0edf3b98e4b3e68a13776e034b9dd86ad7e529d.zip cpython-b0edf3b98e4b3e68a13776e034b9dd86ad7e529d.tar.gz cpython-b0edf3b98e4b3e68a13776e034b9dd86ad7e529d.tar.bz2 |
GH-91079: Rename C_RECURSION_LIMIT to Py_C_RECURSION_LIMIT (#108507)
Symbols of the C API should be prefixed by "Py_" to avoid conflict
with existing names in 3rd party C extensions on "#include <Python.h>".
test.pythoninfo now logs Py_C_RECURSION_LIMIT constant and other
_testcapi and _testinternalcapi constants.
Diffstat (limited to 'Lib/test/pythoninfo.py')
-rw-r--r-- | Lib/test/pythoninfo.py | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/Lib/test/pythoninfo.py b/Lib/test/pythoninfo.py index c628833..b25def7 100644 --- a/Lib/test/pythoninfo.py +++ b/Lib/test/pythoninfo.py @@ -666,12 +666,34 @@ def collect_decimal(info_add): def collect_testcapi(info_add): try: + import _testcapi + except ImportError: + return + + for name in ( + 'LONG_MAX', # always 32-bit on Windows, 64-bit on 64-bit Unix + 'PY_SSIZE_T_MAX', + 'Py_C_RECURSION_LIMIT', + 'SIZEOF_TIME_T', # 32-bit or 64-bit depending on the platform + 'SIZEOF_WCHAR_T', # 16-bit or 32-bit depending on the platform + ): + copy_attr(info_add, f'_testcapi.{name}', _testcapi, name) + + +def collect_testinternalcapi(info_add): + try: import _testinternalcapi except ImportError: return call_func(info_add, 'pymem.allocator', _testinternalcapi, 'pymem_getallocatorsname') + for name in ( + 'SIZEOF_PYGC_HEAD', + 'SIZEOF_PYOBJECT', + ): + copy_attr(info_add, f'_testinternalcapi.{name}', _testinternalcapi, name) + def collect_resource(info_add): try: @@ -907,6 +929,7 @@ def collect_info(info): collect_sys, collect_sysconfig, collect_testcapi, + collect_testinternalcapi, collect_time, collect_tkinter, collect_windows, |