mirror of
https://github.com/python/cpython.git
synced 2025-11-25 21:11:09 +00:00
gh-106320: Remove private _PyLong_FileDescriptor_Converter() (#108503)
Move the private _PyLong converter functions to the internal C API * _PyLong_FileDescriptor_Converter(): moved to pycore_fileutils.h * _PyLong_Size_t_Converter(): moved to pycore_long.h Argument Clinic now emits includes for pycore_fileutils.h and pycore_long.h when these functions are used.
This commit is contained in:
parent
713afb8804
commit
6353c21b78
13 changed files with 43 additions and 10 deletions
|
|
@ -12,13 +12,16 @@ NEED_BUILD_CORE = {
|
|||
'multibytecodec.h',
|
||||
'socketmodule.h',
|
||||
|
||||
# Argument Clinic ".c.h" files
|
||||
# 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',
|
||||
}
|
||||
|
||||
TOOL = 'gcc'
|
||||
|
|
|
|||
|
|
@ -3835,6 +3835,10 @@ class size_t_converter(CConverter):
|
|||
converter = '_PyLong_Size_t_Converter'
|
||||
c_ignored_default = "0"
|
||||
|
||||
def converter_init(self, *, accept: TypeSet = {int, NoneType}) -> None:
|
||||
self.add_include('pycore_long.h',
|
||||
'_PyLong_Size_t_Converter()')
|
||||
|
||||
def parse_arg(self, argname: str, displayname: str) -> str | None:
|
||||
if self.format_unit == 'n':
|
||||
return """
|
||||
|
|
@ -3850,6 +3854,10 @@ class fildes_converter(CConverter):
|
|||
type = 'int'
|
||||
converter = '_PyLong_FileDescriptor_Converter'
|
||||
|
||||
def converter_init(self, *, accept: TypeSet = {int, NoneType}) -> None:
|
||||
self.add_include('pycore_fileutils.h',
|
||||
'_PyLong_FileDescriptor_Converter()')
|
||||
|
||||
def _parse_arg(self, argname: str, displayname: str) -> str | None:
|
||||
return """
|
||||
{paramname} = PyObject_AsFileDescriptor({argname});
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue