mirror of
https://github.com/python/cpython.git
synced 2025-08-28 20:56:54 +00:00
gh-106320: Remove private AC converter functions (#108505)
Move these private functions to the internal C API (pycore_abstract.h): * _Py_convert_optional_to_ssize_t() * _PyNumber_Index() Argument Clinic now emits #include "pycore_abstract.h" when these functions are used. The parser of the c-analyzer tool now uses a list of files which use the limited C API, rather than a list of files using the internal C API.
This commit is contained in:
parent
6353c21b78
commit
8ba4714611
41 changed files with 88 additions and 62 deletions
|
@ -3,26 +3,14 @@ import re
|
|||
|
||||
from . import common as _common
|
||||
|
||||
# Modules/socketmodule.h uses pycore_time.h which needs the Py_BUILD_CORE
|
||||
# macro. Usually it's defined by the C file which includes it.
|
||||
# Other header files have a similar issue.
|
||||
NEED_BUILD_CORE = {
|
||||
# Header ".h" files
|
||||
'cjkcodecs.h',
|
||||
'multibytecodec.h',
|
||||
'socketmodule.h',
|
||||
|
||||
# Argument Clinic ".c.h" header files
|
||||
'_testclinic.c.h',
|
||||
'_testclinic_depr.c.h',
|
||||
'_winapi.c.h',
|
||||
'fcntlmodule.c.h',
|
||||
'overlapped.c.h',
|
||||
'posixmodule.c.h',
|
||||
'selectmodule.c.h',
|
||||
'sha3module.c.h',
|
||||
'termios.c.h',
|
||||
}
|
||||
# The following C files must not be built with Py_BUILD_CORE,
|
||||
# because they use the limited C API.
|
||||
USE_LIMITED_C_API = frozenset((
|
||||
'_testcapimodule.c',
|
||||
'_testclinic_limited.c',
|
||||
'xxlimited.c',
|
||||
'xxlimited_35.c',
|
||||
))
|
||||
|
||||
TOOL = 'gcc'
|
||||
|
||||
|
@ -81,8 +69,9 @@ def preprocess(filename,
|
|||
cwd = os.path.abspath(cwd or '.')
|
||||
filename = _normpath(filename, cwd)
|
||||
|
||||
print(filename)
|
||||
postargs = POST_ARGS
|
||||
if os.path.basename(filename) in NEED_BUILD_CORE:
|
||||
if os.path.basename(filename) not in USE_LIMITED_C_API:
|
||||
postargs += ('-DPy_BUILD_CORE=1',)
|
||||
|
||||
text = _common.preprocess(
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue