mirror of
https://github.com/python/cpython.git
synced 2025-08-29 13:15:11 +00:00
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.
This commit is contained in:
parent
15d4c9fabc
commit
b0edf3b98e
17 changed files with 67 additions and 39 deletions
|
@ -665,6 +665,22 @@ 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:
|
||||
|
@ -672,6 +688,12 @@ def collect_testcapi(info_add):
|
|||
|
||||
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,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue