mirror of https://github.com/python/cpython
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
|
@ -15,5 +15,3 @@ typedef PyObject * (*Py_OpenCodeHookFunction)(PyObject *, void *);
|
|||
PyAPI_FUNC(PyObject *) PyFile_OpenCode(const char *utf8path);
|
||||
PyAPI_FUNC(PyObject *) PyFile_OpenCodeObject(PyObject *path);
|
||||
PyAPI_FUNC(int) PyFile_SetOpenCodeHook(Py_OpenCodeHookFunction hook, void *userData);
|
||||
|
||||
PyAPI_FUNC(int) _PyLong_FileDescriptor_Converter(PyObject *, void *);
|
||||
|
|
|
@ -2,8 +2,6 @@
|
|||
# error "this header file must not be included directly"
|
||||
#endif
|
||||
|
||||
PyAPI_FUNC(int) _PyLong_Size_t_Converter(PyObject *, void *);
|
||||
|
||||
PyAPI_FUNC(PyObject*) PyLong_FromUnicodeObject(PyObject *u, int base);
|
||||
|
||||
/* _PyLong_Sign. Return 0 if v is 0, -1 if v < 0, +1 if v > 0.
|
||||
|
|
|
@ -312,6 +312,9 @@ extern HRESULT PathCchSkipRoot(const wchar_t *pszPath, const wchar_t **ppszRootE
|
|||
# define _Py_END_SUPPRESS_IPH
|
||||
#endif /* _MSC_VER >= 1900 */
|
||||
|
||||
// Export for 'select' shared extension (Argument Clinic code)
|
||||
PyAPI_FUNC(int) _PyLong_FileDescriptor_Converter(PyObject *, void *);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
|
|
@ -187,11 +187,21 @@ extern char* _PyLong_FormatBytesWriter(
|
|||
int alternate);
|
||||
|
||||
// Argument converters used by Argument Clinic
|
||||
|
||||
// Export for 'select' shared extension (Argument Clinic code)
|
||||
PyAPI_FUNC(int) _PyLong_UnsignedShort_Converter(PyObject *, void *);
|
||||
|
||||
// Export for '_testclinic' shared extension (Argument Clinic code)
|
||||
PyAPI_FUNC(int) _PyLong_UnsignedInt_Converter(PyObject *, void *);
|
||||
|
||||
// Export for '_blake2' shared extension (Argument Clinic code)
|
||||
PyAPI_FUNC(int) _PyLong_UnsignedLong_Converter(PyObject *, void *);
|
||||
|
||||
// Export for '_blake2' shared extension (Argument Clinic code)
|
||||
PyAPI_FUNC(int) _PyLong_UnsignedLongLong_Converter(PyObject *, void *);
|
||||
|
||||
// Export for '_testclinic' shared extension (Argument Clinic code)
|
||||
PyAPI_FUNC(int) _PyLong_Size_t_Converter(PyObject *, void *);
|
||||
|
||||
/* Long value tag bits:
|
||||
* 0-1: Sign bits value = (1-sign), ie. negative=2, positive=0, zero=1.
|
||||
|
|
|
@ -7,6 +7,7 @@ preserve
|
|||
# include "pycore_runtime.h" // _Py_ID()
|
||||
#endif
|
||||
|
||||
#include "pycore_long.h" // _PyLong_Size_t_Converter()
|
||||
|
||||
PyDoc_STRVAR(_winapi_Overlapped_GetOverlappedResult__doc__,
|
||||
"GetOverlappedResult($self, wait, /)\n"
|
||||
|
@ -1478,4 +1479,4 @@ exit:
|
|||
|
||||
return return_value;
|
||||
}
|
||||
/*[clinic end generated code: output=ff91ab5cae8961dd input=a9049054013a1b77]*/
|
||||
/*[clinic end generated code: output=c7e08927e163ef13 input=a9049054013a1b77]*/
|
||||
|
|
|
@ -7,6 +7,7 @@ preserve
|
|||
# include "pycore_runtime.h" // _Py_ID()
|
||||
#endif
|
||||
|
||||
#include "pycore_fileutils.h" // _PyLong_FileDescriptor_Converter()
|
||||
|
||||
PyDoc_STRVAR(fcntl_fcntl__doc__,
|
||||
"fcntl($module, fd, cmd, arg=0, /)\n"
|
||||
|
@ -249,4 +250,4 @@ skip_optional:
|
|||
exit:
|
||||
return return_value;
|
||||
}
|
||||
/*[clinic end generated code: output=705976d5f53f2272 input=a9049054013a1b77]*/
|
||||
/*[clinic end generated code: output=5f096e8731fa38be input=a9049054013a1b77]*/
|
||||
|
|
|
@ -7,6 +7,7 @@ preserve
|
|||
# include "pycore_runtime.h" // _Py_ID()
|
||||
#endif
|
||||
|
||||
#include "pycore_fileutils.h" // _PyLong_FileDescriptor_Converter()
|
||||
#include "pycore_long.h" // _PyLong_UnsignedInt_Converter()
|
||||
|
||||
PyDoc_STRVAR(os_stat__doc__,
|
||||
|
@ -11991,4 +11992,4 @@ exit:
|
|||
#ifndef OS_WAITSTATUS_TO_EXITCODE_METHODDEF
|
||||
#define OS_WAITSTATUS_TO_EXITCODE_METHODDEF
|
||||
#endif /* !defined(OS_WAITSTATUS_TO_EXITCODE_METHODDEF) */
|
||||
/*[clinic end generated code: output=a08a47b52da6da0b input=a9049054013a1b77]*/
|
||||
/*[clinic end generated code: output=ff0e50316f4ed71a input=a9049054013a1b77]*/
|
||||
|
|
|
@ -7,6 +7,7 @@ preserve
|
|||
# include "pycore_runtime.h" // _Py_ID()
|
||||
#endif
|
||||
|
||||
#include "pycore_fileutils.h" // _PyLong_FileDescriptor_Converter()
|
||||
#include "pycore_long.h" // _PyLong_UnsignedShort_Converter()
|
||||
|
||||
PyDoc_STRVAR(select_select__doc__,
|
||||
|
@ -1310,4 +1311,4 @@ exit:
|
|||
#ifndef SELECT_KQUEUE_CONTROL_METHODDEF
|
||||
#define SELECT_KQUEUE_CONTROL_METHODDEF
|
||||
#endif /* !defined(SELECT_KQUEUE_CONTROL_METHODDEF) */
|
||||
/*[clinic end generated code: output=a19c29946a931dce input=a9049054013a1b77]*/
|
||||
/*[clinic end generated code: output=a215af2157f038c7 input=a9049054013a1b77]*/
|
||||
|
|
|
@ -7,6 +7,7 @@ preserve
|
|||
# include "pycore_runtime.h" // _Py_ID()
|
||||
#endif
|
||||
|
||||
#include "pycore_fileutils.h" // _PyLong_FileDescriptor_Converter()
|
||||
|
||||
PyDoc_STRVAR(termios_tcgetattr__doc__,
|
||||
"tcgetattr($module, fd, /)\n"
|
||||
|
@ -292,4 +293,4 @@ termios_tcsetwinsize(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
|
|||
exit:
|
||||
return return_value;
|
||||
}
|
||||
/*[clinic end generated code: output=4c79a3bf87370275 input=a9049054013a1b77]*/
|
||||
/*[clinic end generated code: output=434df4394b596e92 input=a9049054013a1b77]*/
|
||||
|
|
|
@ -1,5 +1,9 @@
|
|||
/* fcntl module */
|
||||
|
||||
#ifndef Py_BUILD_CORE_BUILTIN
|
||||
# define Py_BUILD_CORE_MODULE 1
|
||||
#endif
|
||||
|
||||
#include "Python.h"
|
||||
|
||||
#ifdef HAVE_SYS_FILE_H
|
||||
|
|
|
@ -1,5 +1,9 @@
|
|||
/* termios.c -- POSIX terminal I/O module implementation. */
|
||||
|
||||
#ifndef Py_BUILD_CORE_BUILTIN
|
||||
# define Py_BUILD_CORE_MODULE 1
|
||||
#endif
|
||||
|
||||
#include "Python.h"
|
||||
|
||||
/* Apparently, on SGI, termios.h won't define CTRL if _XOPEN_SOURCE
|
||||
|
|
|
@ -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…
Reference in New Issue