diff options
Diffstat (limited to 'Modules/clinic/_winapi.c.h')
-rw-r--r-- | Modules/clinic/_winapi.c.h | 143 |
1 files changed, 92 insertions, 51 deletions
diff --git a/Modules/clinic/_winapi.c.h b/Modules/clinic/_winapi.c.h index ac38d374a2..5bfbaf0d56 100644 --- a/Modules/clinic/_winapi.c.h +++ b/Modules/clinic/_winapi.c.h @@ -19,8 +19,9 @@ _winapi_Overlapped_GetOverlappedResult(OverlappedObject *self, PyObject *arg) PyObject *return_value = NULL; int wait; - if (!PyArg_Parse(arg, "p:GetOverlappedResult", &wait)) + if (!PyArg_Parse(arg, "p:GetOverlappedResult", &wait)) { goto exit; + } return_value = _winapi_Overlapped_GetOverlappedResult_impl(self, wait); exit: @@ -79,8 +80,9 @@ _winapi_CloseHandle(PyObject *module, PyObject *arg) PyObject *return_value = NULL; HANDLE handle; - if (!PyArg_Parse(arg, "" F_HANDLE ":CloseHandle", &handle)) + if (!PyArg_Parse(arg, "" F_HANDLE ":CloseHandle", &handle)) { goto exit; + } return_value = _winapi_CloseHandle_impl(module, handle); exit: @@ -93,23 +95,25 @@ PyDoc_STRVAR(_winapi_ConnectNamedPipe__doc__, "\n"); #define _WINAPI_CONNECTNAMEDPIPE_METHODDEF \ - {"ConnectNamedPipe", (PyCFunction)_winapi_ConnectNamedPipe, METH_VARARGS|METH_KEYWORDS, _winapi_ConnectNamedPipe__doc__}, + {"ConnectNamedPipe", (PyCFunction)_winapi_ConnectNamedPipe, METH_FASTCALL, _winapi_ConnectNamedPipe__doc__}, static PyObject * _winapi_ConnectNamedPipe_impl(PyObject *module, HANDLE handle, int use_overlapped); static PyObject * -_winapi_ConnectNamedPipe(PyObject *module, PyObject *args, PyObject *kwargs) +_winapi_ConnectNamedPipe(PyObject *module, PyObject **args, Py_ssize_t nargs, PyObject *kwnames) { PyObject *return_value = NULL; - static char *_keywords[] = {"handle", "overlapped", NULL}; + static const char * const _keywords[] = {"handle", "overlapped", NULL}; + static _PyArg_Parser _parser = {"" F_HANDLE "|i:ConnectNamedPipe", _keywords, 0}; HANDLE handle; int use_overlapped = 0; - if (!PyArg_ParseTupleAndKeywords(args, kwargs, "" F_HANDLE "|i:ConnectNamedPipe", _keywords, - &handle, &use_overlapped)) + if (!_PyArg_ParseStack(args, nargs, kwnames, &_parser, + &handle, &use_overlapped)) { goto exit; + } return_value = _winapi_ConnectNamedPipe_impl(module, handle, use_overlapped); exit: @@ -147,13 +151,16 @@ _winapi_CreateFile(PyObject *module, PyObject *args) HANDLE _return_value; if (!PyArg_ParseTuple(args, "skk" F_POINTER "kk" F_HANDLE ":CreateFile", - &file_name, &desired_access, &share_mode, &security_attributes, &creation_disposition, &flags_and_attributes, &template_file)) + &file_name, &desired_access, &share_mode, &security_attributes, &creation_disposition, &flags_and_attributes, &template_file)) { goto exit; + } _return_value = _winapi_CreateFile_impl(module, file_name, desired_access, share_mode, security_attributes, creation_disposition, flags_and_attributes, template_file); - if ((_return_value == INVALID_HANDLE_VALUE) && PyErr_Occurred()) + if ((_return_value == INVALID_HANDLE_VALUE) && PyErr_Occurred()) { goto exit; - if (_return_value == NULL) + } + if (_return_value == NULL) { Py_RETURN_NONE; + } return_value = HANDLE_TO_PYNUM(_return_value); exit: @@ -180,8 +187,9 @@ _winapi_CreateJunction(PyObject *module, PyObject *args) LPWSTR dst_path; if (!PyArg_ParseTuple(args, "uu:CreateJunction", - &src_path, &dst_path)) + &src_path, &dst_path)) { goto exit; + } return_value = _winapi_CreateJunction_impl(module, src_path, dst_path); exit: @@ -220,13 +228,16 @@ _winapi_CreateNamedPipe(PyObject *module, PyObject *args) HANDLE _return_value; if (!PyArg_ParseTuple(args, "skkkkkk" F_POINTER ":CreateNamedPipe", - &name, &open_mode, &pipe_mode, &max_instances, &out_buffer_size, &in_buffer_size, &default_timeout, &security_attributes)) + &name, &open_mode, &pipe_mode, &max_instances, &out_buffer_size, &in_buffer_size, &default_timeout, &security_attributes)) { goto exit; + } _return_value = _winapi_CreateNamedPipe_impl(module, name, open_mode, pipe_mode, max_instances, out_buffer_size, in_buffer_size, default_timeout, security_attributes); - if ((_return_value == INVALID_HANDLE_VALUE) && PyErr_Occurred()) + if ((_return_value == INVALID_HANDLE_VALUE) && PyErr_Occurred()) { goto exit; - if (_return_value == NULL) + } + if (_return_value == NULL) { Py_RETURN_NONE; + } return_value = HANDLE_TO_PYNUM(_return_value); exit: @@ -258,8 +269,9 @@ _winapi_CreatePipe(PyObject *module, PyObject *args) DWORD size; if (!PyArg_ParseTuple(args, "Ok:CreatePipe", - &pipe_attrs, &size)) + &pipe_attrs, &size)) { goto exit; + } return_value = _winapi_CreatePipe_impl(module, pipe_attrs, size); exit: @@ -308,8 +320,9 @@ _winapi_CreateProcess(PyObject *module, PyObject *args) PyObject *startup_info; if (!PyArg_ParseTuple(args, "ZZOOikOZO:CreateProcess", - &application_name, &command_line, &proc_attrs, &thread_attrs, &inherit_handles, &creation_flags, &env_mapping, ¤t_directory, &startup_info)) + &application_name, &command_line, &proc_attrs, &thread_attrs, &inherit_handles, &creation_flags, &env_mapping, ¤t_directory, &startup_info)) { goto exit; + } return_value = _winapi_CreateProcess_impl(module, application_name, command_line, proc_attrs, thread_attrs, inherit_handles, creation_flags, env_mapping, current_directory, startup_info); exit: @@ -351,13 +364,16 @@ _winapi_DuplicateHandle(PyObject *module, PyObject *args) HANDLE _return_value; if (!PyArg_ParseTuple(args, "" F_HANDLE "" F_HANDLE "" F_HANDLE "ki|k:DuplicateHandle", - &source_process_handle, &source_handle, &target_process_handle, &desired_access, &inherit_handle, &options)) + &source_process_handle, &source_handle, &target_process_handle, &desired_access, &inherit_handle, &options)) { goto exit; + } _return_value = _winapi_DuplicateHandle_impl(module, source_process_handle, source_handle, target_process_handle, desired_access, inherit_handle, options); - if ((_return_value == INVALID_HANDLE_VALUE) && PyErr_Occurred()) + if ((_return_value == INVALID_HANDLE_VALUE) && PyErr_Occurred()) { goto exit; - if (_return_value == NULL) + } + if (_return_value == NULL) { Py_RETURN_NONE; + } return_value = HANDLE_TO_PYNUM(_return_value); exit: @@ -381,8 +397,9 @@ _winapi_ExitProcess(PyObject *module, PyObject *arg) PyObject *return_value = NULL; UINT ExitCode; - if (!PyArg_Parse(arg, "I:ExitProcess", &ExitCode)) + if (!PyArg_Parse(arg, "I:ExitProcess", &ExitCode)) { goto exit; + } return_value = _winapi_ExitProcess_impl(module, ExitCode); exit: @@ -408,10 +425,12 @@ _winapi_GetCurrentProcess(PyObject *module, PyObject *Py_UNUSED(ignored)) HANDLE _return_value; _return_value = _winapi_GetCurrentProcess_impl(module); - if ((_return_value == INVALID_HANDLE_VALUE) && PyErr_Occurred()) + if ((_return_value == INVALID_HANDLE_VALUE) && PyErr_Occurred()) { goto exit; - if (_return_value == NULL) + } + if (_return_value == NULL) { Py_RETURN_NONE; + } return_value = HANDLE_TO_PYNUM(_return_value); exit: @@ -437,11 +456,13 @@ _winapi_GetExitCodeProcess(PyObject *module, PyObject *arg) HANDLE process; DWORD _return_value; - if (!PyArg_Parse(arg, "" F_HANDLE ":GetExitCodeProcess", &process)) + if (!PyArg_Parse(arg, "" F_HANDLE ":GetExitCodeProcess", &process)) { goto exit; + } _return_value = _winapi_GetExitCodeProcess_impl(module, process); - if ((_return_value == DWORD_MAX) && PyErr_Occurred()) + if ((_return_value == DWORD_MAX) && PyErr_Occurred()) { goto exit; + } return_value = Py_BuildValue("k", _return_value); exit: @@ -466,8 +487,9 @@ _winapi_GetLastError(PyObject *module, PyObject *Py_UNUSED(ignored)) DWORD _return_value; _return_value = _winapi_GetLastError_impl(module); - if ((_return_value == DWORD_MAX) && PyErr_Occurred()) + if ((_return_value == DWORD_MAX) && PyErr_Occurred()) { goto exit; + } return_value = Py_BuildValue("k", _return_value); exit: @@ -499,8 +521,9 @@ _winapi_GetModuleFileName(PyObject *module, PyObject *arg) PyObject *return_value = NULL; HMODULE module_handle; - if (!PyArg_Parse(arg, "" F_HANDLE ":GetModuleFileName", &module_handle)) + if (!PyArg_Parse(arg, "" F_HANDLE ":GetModuleFileName", &module_handle)) { goto exit; + } return_value = _winapi_GetModuleFileName_impl(module, module_handle); exit: @@ -531,13 +554,16 @@ _winapi_GetStdHandle(PyObject *module, PyObject *arg) DWORD std_handle; HANDLE _return_value; - if (!PyArg_Parse(arg, "k:GetStdHandle", &std_handle)) + if (!PyArg_Parse(arg, "k:GetStdHandle", &std_handle)) { goto exit; + } _return_value = _winapi_GetStdHandle_impl(module, std_handle); - if ((_return_value == INVALID_HANDLE_VALUE) && PyErr_Occurred()) + if ((_return_value == INVALID_HANDLE_VALUE) && PyErr_Occurred()) { goto exit; - if (_return_value == NULL) + } + if (_return_value == NULL) { Py_RETURN_NONE; + } return_value = HANDLE_TO_PYNUM(_return_value); exit: @@ -563,8 +589,9 @@ _winapi_GetVersion(PyObject *module, PyObject *Py_UNUSED(ignored)) long _return_value; _return_value = _winapi_GetVersion_impl(module); - if ((_return_value == -1) && PyErr_Occurred()) + if ((_return_value == -1) && PyErr_Occurred()) { goto exit; + } return_value = PyLong_FromLong(_return_value); exit: @@ -593,13 +620,16 @@ _winapi_OpenProcess(PyObject *module, PyObject *args) HANDLE _return_value; if (!PyArg_ParseTuple(args, "kik:OpenProcess", - &desired_access, &inherit_handle, &process_id)) + &desired_access, &inherit_handle, &process_id)) { goto exit; + } _return_value = _winapi_OpenProcess_impl(module, desired_access, inherit_handle, process_id); - if ((_return_value == INVALID_HANDLE_VALUE) && PyErr_Occurred()) + if ((_return_value == INVALID_HANDLE_VALUE) && PyErr_Occurred()) { goto exit; - if (_return_value == NULL) + } + if (_return_value == NULL) { Py_RETURN_NONE; + } return_value = HANDLE_TO_PYNUM(_return_value); exit: @@ -625,8 +655,9 @@ _winapi_PeekNamedPipe(PyObject *module, PyObject *args) int size = 0; if (!PyArg_ParseTuple(args, "" F_HANDLE "|i:PeekNamedPipe", - &handle, &size)) + &handle, &size)) { goto exit; + } return_value = _winapi_PeekNamedPipe_impl(module, handle, size); exit: @@ -639,24 +670,26 @@ PyDoc_STRVAR(_winapi_ReadFile__doc__, "\n"); #define _WINAPI_READFILE_METHODDEF \ - {"ReadFile", (PyCFunction)_winapi_ReadFile, METH_VARARGS|METH_KEYWORDS, _winapi_ReadFile__doc__}, + {"ReadFile", (PyCFunction)_winapi_ReadFile, METH_FASTCALL, _winapi_ReadFile__doc__}, static PyObject * _winapi_ReadFile_impl(PyObject *module, HANDLE handle, int size, int use_overlapped); static PyObject * -_winapi_ReadFile(PyObject *module, PyObject *args, PyObject *kwargs) +_winapi_ReadFile(PyObject *module, PyObject **args, Py_ssize_t nargs, PyObject *kwnames) { PyObject *return_value = NULL; - static char *_keywords[] = {"handle", "size", "overlapped", NULL}; + static const char * const _keywords[] = {"handle", "size", "overlapped", NULL}; + static _PyArg_Parser _parser = {"" F_HANDLE "i|i:ReadFile", _keywords, 0}; HANDLE handle; int size; int use_overlapped = 0; - if (!PyArg_ParseTupleAndKeywords(args, kwargs, "" F_HANDLE "i|i:ReadFile", _keywords, - &handle, &size, &use_overlapped)) + if (!_PyArg_ParseStack(args, nargs, kwnames, &_parser, + &handle, &size, &use_overlapped)) { goto exit; + } return_value = _winapi_ReadFile_impl(module, handle, size, use_overlapped); exit: @@ -688,8 +721,9 @@ _winapi_SetNamedPipeHandleState(PyObject *module, PyObject *args) PyObject *collect_data_timeout; if (!PyArg_ParseTuple(args, "" F_HANDLE "OOO:SetNamedPipeHandleState", - &named_pipe, &mode, &max_collection_count, &collect_data_timeout)) + &named_pipe, &mode, &max_collection_count, &collect_data_timeout)) { goto exit; + } return_value = _winapi_SetNamedPipeHandleState_impl(module, named_pipe, mode, max_collection_count, collect_data_timeout); exit: @@ -717,8 +751,9 @@ _winapi_TerminateProcess(PyObject *module, PyObject *args) UINT exit_code; if (!PyArg_ParseTuple(args, "" F_HANDLE "I:TerminateProcess", - &handle, &exit_code)) + &handle, &exit_code)) { goto exit; + } return_value = _winapi_TerminateProcess_impl(module, handle, exit_code); exit: @@ -744,8 +779,9 @@ _winapi_WaitNamedPipe(PyObject *module, PyObject *args) DWORD timeout; if (!PyArg_ParseTuple(args, "sk:WaitNamedPipe", - &name, &timeout)) + &name, &timeout)) { goto exit; + } return_value = _winapi_WaitNamedPipe_impl(module, name, timeout); exit: @@ -774,8 +810,9 @@ _winapi_WaitForMultipleObjects(PyObject *module, PyObject *args) DWORD milliseconds = INFINITE; if (!PyArg_ParseTuple(args, "Oi|k:WaitForMultipleObjects", - &handle_seq, &wait_flag, &milliseconds)) + &handle_seq, &wait_flag, &milliseconds)) { goto exit; + } return_value = _winapi_WaitForMultipleObjects_impl(module, handle_seq, wait_flag, milliseconds); exit: @@ -808,11 +845,13 @@ _winapi_WaitForSingleObject(PyObject *module, PyObject *args) long _return_value; if (!PyArg_ParseTuple(args, "" F_HANDLE "k:WaitForSingleObject", - &handle, &milliseconds)) + &handle, &milliseconds)) { goto exit; + } _return_value = _winapi_WaitForSingleObject_impl(module, handle, milliseconds); - if ((_return_value == -1) && PyErr_Occurred()) + if ((_return_value == -1) && PyErr_Occurred()) { goto exit; + } return_value = PyLong_FromLong(_return_value); exit: @@ -825,27 +864,29 @@ PyDoc_STRVAR(_winapi_WriteFile__doc__, "\n"); #define _WINAPI_WRITEFILE_METHODDEF \ - {"WriteFile", (PyCFunction)_winapi_WriteFile, METH_VARARGS|METH_KEYWORDS, _winapi_WriteFile__doc__}, + {"WriteFile", (PyCFunction)_winapi_WriteFile, METH_FASTCALL, _winapi_WriteFile__doc__}, static PyObject * _winapi_WriteFile_impl(PyObject *module, HANDLE handle, PyObject *buffer, int use_overlapped); static PyObject * -_winapi_WriteFile(PyObject *module, PyObject *args, PyObject *kwargs) +_winapi_WriteFile(PyObject *module, PyObject **args, Py_ssize_t nargs, PyObject *kwnames) { PyObject *return_value = NULL; - static char *_keywords[] = {"handle", "buffer", "overlapped", NULL}; + static const char * const _keywords[] = {"handle", "buffer", "overlapped", NULL}; + static _PyArg_Parser _parser = {"" F_HANDLE "O|i:WriteFile", _keywords, 0}; HANDLE handle; PyObject *buffer; int use_overlapped = 0; - if (!PyArg_ParseTupleAndKeywords(args, kwargs, "" F_HANDLE "O|i:WriteFile", _keywords, - &handle, &buffer, &use_overlapped)) + if (!_PyArg_ParseStack(args, nargs, kwnames, &_parser, + &handle, &buffer, &use_overlapped)) { goto exit; + } return_value = _winapi_WriteFile_impl(module, handle, buffer, use_overlapped); exit: return return_value; } -/*[clinic end generated code: output=a4c4b2a9fcb0bea1 input=a9049054013a1b77]*/ +/*[clinic end generated code: output=46d6382a6662c4a9 input=a9049054013a1b77]*/ |