summaryrefslogtreecommitdiffstats
path: root/Tools/c-analyzer/c_parser
diff options
context:
space:
mode:
authorVictor Stinner <vstinner@python.org>2023-08-26 02:05:17 (GMT)
committerGitHub <noreply@github.com>2023-08-26 02:05:17 (GMT)
commit8ba47146111d714c7b61825d43b52311d9be366d (patch)
tree061438cacfecebab0264ef41fb94e11a40431924 /Tools/c-analyzer/c_parser
parent6353c21b78a3d91e7cd7810f1c00258a34e85fe7 (diff)
downloadcpython-8ba47146111d714c7b61825d43b52311d9be366d.zip
cpython-8ba47146111d714c7b61825d43b52311d9be366d.tar.gz
cpython-8ba47146111d714c7b61825d43b52311d9be366d.tar.bz2
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.
Diffstat (limited to 'Tools/c-analyzer/c_parser')
-rw-r--r--Tools/c-analyzer/c_parser/preprocessor/gcc.py31
1 files changed, 10 insertions, 21 deletions
diff --git a/Tools/c-analyzer/c_parser/preprocessor/gcc.py b/Tools/c-analyzer/c_parser/preprocessor/gcc.py
index de9a248..55cc2d3 100644
--- a/Tools/c-analyzer/c_parser/preprocessor/gcc.py
+++ b/Tools/c-analyzer/c_parser/preprocessor/gcc.py
@@ -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(