summaryrefslogtreecommitdiffstats
path: root/Tools
diff options
context:
space:
mode:
authorVictor Stinner <vstinner@python.org>2023-08-26 00:24:27 (GMT)
committerGitHub <noreply@github.com>2023-08-26 00:24:27 (GMT)
commit713afb8804666405f29115cf459b591308e3ab54 (patch)
treedb6bdfbbf19f1b222c4d6a6e027efd6a4202e96c /Tools
parent86bc9e35c4aaf3bcc045ddd998844ffb64fec3a2 (diff)
downloadcpython-713afb8804666405f29115cf459b591308e3ab54.zip
cpython-713afb8804666405f29115cf459b591308e3ab54.tar.gz
cpython-713afb8804666405f29115cf459b591308e3ab54.tar.bz2
gh-106320: Remove private _PyLong converter functions (#108499)
Move these private functions to the internal C API (pycore_long.h): * _PyLong_UnsignedInt_Converter() * _PyLong_UnsignedLongLong_Converter() * _PyLong_UnsignedLong_Converter() * _PyLong_UnsignedShort_Converter() Argument Clinic now emits #include "pycore_long.h" when these functions are used.
Diffstat (limited to 'Tools')
-rw-r--r--Tools/c-analyzer/c_parser/preprocessor/gcc.py9
-rwxr-xr-xTools/clinic/clinic.py8
2 files changed, 17 insertions, 0 deletions
diff --git a/Tools/c-analyzer/c_parser/preprocessor/gcc.py b/Tools/c-analyzer/c_parser/preprocessor/gcc.py
index 415a2ba..62538f5 100644
--- a/Tools/c-analyzer/c_parser/preprocessor/gcc.py
+++ b/Tools/c-analyzer/c_parser/preprocessor/gcc.py
@@ -7,9 +7,18 @@ from . import common as _common
# 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" files
+ '_testclinic.c.h',
+ '_testclinic_depr.c.h',
+ 'overlapped.c.h',
+ 'posixmodule.c.h',
+ 'selectmodule.c.h',
+ 'sha3module.c.h',
}
TOOL = 'gcc'
diff --git a/Tools/clinic/clinic.py b/Tools/clinic/clinic.py
index a6974bd..c4304bb 100755
--- a/Tools/clinic/clinic.py
+++ b/Tools/clinic/clinic.py
@@ -3629,6 +3629,8 @@ class unsigned_short_converter(CConverter):
self.format_unit = 'H'
else:
self.converter = '_PyLong_UnsignedShort_Converter'
+ self.add_include('pycore_long.h',
+ '_PyLong_UnsignedShort_Converter()')
def parse_arg(self, argname: str, displayname: str) -> str | None:
if self.format_unit == 'H':
@@ -3690,6 +3692,8 @@ class unsigned_int_converter(CConverter):
self.format_unit = 'I'
else:
self.converter = '_PyLong_UnsignedInt_Converter'
+ self.add_include('pycore_long.h',
+ '_PyLong_UnsignedInt_Converter()')
def parse_arg(self, argname: str, displayname: str) -> str | None:
if self.format_unit == 'I':
@@ -3727,6 +3731,8 @@ class unsigned_long_converter(CConverter):
self.format_unit = 'k'
else:
self.converter = '_PyLong_UnsignedLong_Converter'
+ self.add_include('pycore_long.h',
+ '_PyLong_UnsignedLong_Converter()')
def parse_arg(self, argname: str, displayname: str) -> str | None:
if self.format_unit == 'k':
@@ -3766,6 +3772,8 @@ class unsigned_long_long_converter(CConverter):
self.format_unit = 'K'
else:
self.converter = '_PyLong_UnsignedLongLong_Converter'
+ self.add_include('pycore_long.h',
+ '_PyLong_UnsignedLongLong_Converter()')
def parse_arg(self, argname: str, displayname: str) -> str | None:
if self.format_unit == 'K':