summaryrefslogtreecommitdiffstats
path: root/Modules/overlapped.c
diff options
context:
space:
mode:
authorZackery Spytz <zspytz@gmail.com>2020-07-10 17:43:37 (GMT)
committerGitHub <noreply@github.com>2020-07-10 17:43:37 (GMT)
commit9650fe0197779b4dfded94be111e39c5810f098f (patch)
tree4475ed010af267ae216d706dfc41c53094a5d499 /Modules/overlapped.c
parent6fc732a2116e2c42b0431bb7e2a21719351af755 (diff)
downloadcpython-9650fe0197779b4dfded94be111e39c5810f098f.zip
cpython-9650fe0197779b4dfded94be111e39c5810f098f.tar.gz
cpython-9650fe0197779b4dfded94be111e39c5810f098f.tar.bz2
bpo-20179: Convert the _overlapped module to the Argument Clinic (GH-14275)
Diffstat (limited to 'Modules/overlapped.c')
-rw-r--r--Modules/overlapped.c865
1 files changed, 456 insertions, 409 deletions
diff --git a/Modules/overlapped.c b/Modules/overlapped.c
index eed8fbf..9c4e2da 100644
--- a/Modules/overlapped.c
+++ b/Modules/overlapped.c
@@ -37,6 +37,36 @@
#define T_HANDLE T_POINTER
+/*[python input]
+class OVERLAPPED_converter(CConverter):
+ type = 'OVERLAPPED *'
+ format_unit = '"F_POINTER"'
+
+class HANDLE_converter(CConverter):
+ type = 'HANDLE'
+ format_unit = '"F_HANDLE"'
+
+class ULONG_PTR_converter(CConverter):
+ type = 'ULONG_PTR'
+ format_unit = '"F_ULONG_PTR"'
+
+class DWORD_converter(CConverter):
+ type = 'DWORD'
+ format_unit = 'k'
+
+class BOOL_converter(CConverter):
+ type = 'BOOL'
+ format_unit = 'i'
+[python start generated code]*/
+/*[python end generated code: output=da39a3ee5e6b4b0d input=83bb8c2c2514f2a8]*/
+
+/*[clinic input]
+module _overlapped
+class _overlapped.Overlapped "OverlappedObject *" "&OverlappedType"
+[clinic start generated code]*/
+/*[clinic end generated code: output=da39a3ee5e6b4b0d input=92e5a799db35b96c]*/
+
+
enum {TYPE_NONE, TYPE_NOT_STARTED, TYPE_READ, TYPE_READINTO, TYPE_WRITE,
TYPE_ACCEPT, TYPE_CONNECT, TYPE_DISCONNECT, TYPE_CONNECT_NAMED_PIPE,
TYPE_WAIT_NAMED_PIPE_AND_CONNECT, TYPE_TRANSMIT_FILE, TYPE_READ_FROM,
@@ -150,25 +180,27 @@ initialize_function_pointers(void)
* Completion port stuff
*/
-PyDoc_STRVAR(
- CreateIoCompletionPort_doc,
- "CreateIoCompletionPort(handle, port, key, concurrency) -> port\n\n"
- "Create a completion port or register a handle with a port.");
+/*[clinic input]
+_overlapped.CreateIoCompletionPort
+
+ handle as FileHandle: HANDLE
+ port as ExistingCompletionPort: HANDLE
+ key as CompletionKey: ULONG_PTR
+ concurrency as NumberOfConcurrentThreads: DWORD
+ /
+
+Create a completion port or register a handle with a port.
+[clinic start generated code]*/
static PyObject *
-overlapped_CreateIoCompletionPort(PyObject *self, PyObject *args)
+_overlapped_CreateIoCompletionPort_impl(PyObject *module, HANDLE FileHandle,
+ HANDLE ExistingCompletionPort,
+ ULONG_PTR CompletionKey,
+ DWORD NumberOfConcurrentThreads)
+/*[clinic end generated code: output=24ede2b0f05e5433 input=847bae4d0efe1976]*/
{
- HANDLE FileHandle;
- HANDLE ExistingCompletionPort;
- ULONG_PTR CompletionKey;
- DWORD NumberOfConcurrentThreads;
HANDLE ret;
- if (!PyArg_ParseTuple(args, F_HANDLE F_HANDLE F_ULONG_PTR F_DWORD,
- &FileHandle, &ExistingCompletionPort, &CompletionKey,
- &NumberOfConcurrentThreads))
- return NULL;
-
Py_BEGIN_ALLOW_THREADS
ret = CreateIoCompletionPort(FileHandle, ExistingCompletionPort,
CompletionKey, NumberOfConcurrentThreads);
@@ -179,26 +211,30 @@ overlapped_CreateIoCompletionPort(PyObject *self, PyObject *args)
return Py_BuildValue(F_HANDLE, ret);
}
-PyDoc_STRVAR(
- GetQueuedCompletionStatus_doc,
- "GetQueuedCompletionStatus(port, msecs) -> (err, bytes, key, address)\n\n"
- "Get a message from completion port. Wait for up to msecs milliseconds.");
+/*[clinic input]
+_overlapped.GetQueuedCompletionStatus
+
+ port as CompletionPort: HANDLE
+ msecs as Milliseconds: DWORD
+ /
+
+Get a message from completion port.
+
+Wait for up to msecs milliseconds.
+[clinic start generated code]*/
static PyObject *
-overlapped_GetQueuedCompletionStatus(PyObject *self, PyObject *args)
+_overlapped_GetQueuedCompletionStatus_impl(PyObject *module,
+ HANDLE CompletionPort,
+ DWORD Milliseconds)
+/*[clinic end generated code: output=68314171628dddb7 input=94a042d14c4f6410]*/
{
- HANDLE CompletionPort = NULL;
DWORD NumberOfBytes = 0;
ULONG_PTR CompletionKey = 0;
OVERLAPPED *Overlapped = NULL;
- DWORD Milliseconds;
DWORD err;
BOOL ret;
- if (!PyArg_ParseTuple(args, F_HANDLE F_DWORD,
- &CompletionPort, &Milliseconds))
- return NULL;
-
Py_BEGIN_ALLOW_THREADS
ret = GetQueuedCompletionStatus(CompletionPort, &NumberOfBytes,
&CompletionKey, &Overlapped, Milliseconds);
@@ -215,25 +251,28 @@ overlapped_GetQueuedCompletionStatus(PyObject *self, PyObject *args)
err, NumberOfBytes, CompletionKey, Overlapped);
}
-PyDoc_STRVAR(
- PostQueuedCompletionStatus_doc,
- "PostQueuedCompletionStatus(port, bytes, key, address) -> None\n\n"
- "Post a message to completion port.");
+/*[clinic input]
+_overlapped.PostQueuedCompletionStatus
+
+ port as CompletionPort: HANDLE
+ bytes as NumberOfBytes: DWORD
+ key as CompletionKey: ULONG_PTR
+ address as Overlapped: OVERLAPPED
+ /
+
+Post a message to completion port.
+[clinic start generated code]*/
static PyObject *
-overlapped_PostQueuedCompletionStatus(PyObject *self, PyObject *args)
+_overlapped_PostQueuedCompletionStatus_impl(PyObject *module,
+ HANDLE CompletionPort,
+ DWORD NumberOfBytes,
+ ULONG_PTR CompletionKey,
+ OVERLAPPED *Overlapped)
+/*[clinic end generated code: output=93e73f2933a43e9e input=e936202d87937aca]*/
{
- HANDLE CompletionPort;
- DWORD NumberOfBytes;
- ULONG_PTR CompletionKey;
- OVERLAPPED *Overlapped;
BOOL ret;
- if (!PyArg_ParseTuple(args, F_HANDLE F_DWORD F_ULONG_PTR F_POINTER,
- &CompletionPort, &NumberOfBytes, &CompletionKey,
- &Overlapped))
- return NULL;
-
Py_BEGIN_ALLOW_THREADS
ret = PostQueuedCompletionStatus(CompletionPort, NumberOfBytes,
CompletionKey, Overlapped);
@@ -264,26 +303,27 @@ PostToQueueCallback(PVOID lpParameter, BOOL TimerOrWaitFired)
PyMem_RawFree(p);
}
-PyDoc_STRVAR(
- RegisterWaitWithQueue_doc,
- "RegisterWaitWithQueue(Object, CompletionPort, Overlapped, Timeout)\n"
- " -> WaitHandle\n\n"
- "Register wait for Object; when complete CompletionPort is notified.\n");
+/*[clinic input]
+_overlapped.RegisterWaitWithQueue
+
+ Object: HANDLE
+ CompletionPort: HANDLE
+ Overlapped: OVERLAPPED
+ Timeout as Milliseconds: DWORD
+ /
+
+Register wait for Object; when complete CompletionPort is notified.
+[clinic start generated code]*/
static PyObject *
-overlapped_RegisterWaitWithQueue(PyObject *self, PyObject *args)
+_overlapped_RegisterWaitWithQueue_impl(PyObject *module, HANDLE Object,
+ HANDLE CompletionPort,
+ OVERLAPPED *Overlapped,
+ DWORD Milliseconds)
+/*[clinic end generated code: output=c2ace732e447fe45 input=2dd4efee44abe8ee]*/
{
HANDLE NewWaitObject;
- HANDLE Object;
- ULONG Milliseconds;
- struct PostCallbackData data, *pdata;
-
- if (!PyArg_ParseTuple(args, F_HANDLE F_HANDLE F_POINTER F_DWORD,
- &Object,
- &data.CompletionPort,
- &data.Overlapped,
- &Milliseconds))
- return NULL;
+ struct PostCallbackData data = {CompletionPort, Overlapped}, *pdata;
/* Use PyMem_RawMalloc() rather than PyMem_Malloc(), since
PostToQueueCallback() will call PyMem_Free() from a new C thread
@@ -306,20 +346,21 @@ overlapped_RegisterWaitWithQueue(PyObject *self, PyObject *args)
return Py_BuildValue(F_HANDLE, NewWaitObject);
}
-PyDoc_STRVAR(
- UnregisterWait_doc,
- "UnregisterWait(WaitHandle) -> None\n\n"
- "Unregister wait handle.\n");
+/*[clinic input]
+_overlapped.UnregisterWait
+
+ WaitHandle: HANDLE
+ /
+
+Unregister wait handle.
+[clinic start generated code]*/
static PyObject *
-overlapped_UnregisterWait(PyObject *self, PyObject *args)
+_overlapped_UnregisterWait_impl(PyObject *module, HANDLE WaitHandle)
+/*[clinic end generated code: output=ec90cd955a9a617d input=a56709544cb2df0f]*/
{
- HANDLE WaitHandle;
BOOL ret;
- if (!PyArg_ParseTuple(args, F_HANDLE, &WaitHandle))
- return NULL;
-
Py_BEGIN_ALLOW_THREADS
ret = UnregisterWait(WaitHandle);
Py_END_ALLOW_THREADS
@@ -329,20 +370,23 @@ overlapped_UnregisterWait(PyObject *self, PyObject *args)
Py_RETURN_NONE;
}
-PyDoc_STRVAR(
- UnregisterWaitEx_doc,
- "UnregisterWaitEx(WaitHandle, Event) -> None\n\n"
- "Unregister wait handle.\n");
+/*[clinic input]
+_overlapped.UnregisterWaitEx
+
+ WaitHandle: HANDLE
+ Event: HANDLE
+ /
+
+Unregister wait handle.
+[clinic start generated code]*/
static PyObject *
-overlapped_UnregisterWaitEx(PyObject *self, PyObject *args)
+_overlapped_UnregisterWaitEx_impl(PyObject *module, HANDLE WaitHandle,
+ HANDLE Event)
+/*[clinic end generated code: output=2e3d84c1d5f65b92 input=953cddc1de50fab9]*/
{
- HANDLE WaitHandle, Event;
BOOL ret;
- if (!PyArg_ParseTuple(args, F_HANDLE F_HANDLE, &WaitHandle, &Event))
- return NULL;
-
Py_BEGIN_ALLOW_THREADS
ret = UnregisterWaitEx(WaitHandle, Event);
Py_END_ALLOW_THREADS
@@ -356,26 +400,28 @@ overlapped_UnregisterWaitEx(PyObject *self, PyObject *args)
* Event functions -- currently only used by tests
*/
-PyDoc_STRVAR(
- CreateEvent_doc,
- "CreateEvent(EventAttributes, ManualReset, InitialState, Name)"
- " -> Handle\n\n"
- "Create an event. EventAttributes must be None.\n");
+/*[clinic input]
+_overlapped.CreateEvent
+
+ EventAttributes: object
+ ManualReset: BOOL
+ InitialState: BOOL
+ Name: Py_UNICODE(accept={str, NoneType})
+ /
+
+Create an event.
+
+EventAttributes must be None.
+[clinic start generated code]*/
static PyObject *
-overlapped_CreateEvent(PyObject *self, PyObject *args)
+_overlapped_CreateEvent_impl(PyObject *module, PyObject *EventAttributes,
+ BOOL ManualReset, BOOL InitialState,
+ const Py_UNICODE *Name)
+/*[clinic end generated code: output=8e04f0916c17b13d input=dbc36ae14375ba24]*/
{
- PyObject *EventAttributes;
- BOOL ManualReset;
- BOOL InitialState;
- Py_UNICODE *Name;
HANDLE Event;
- if (!PyArg_ParseTuple(args, "O" F_BOOL F_BOOL "Z",
- &EventAttributes, &ManualReset,
- &InitialState, &Name))
- return NULL;
-
if (EventAttributes != Py_None) {
PyErr_SetString(PyExc_ValueError, "EventAttributes must be None");
return NULL;
@@ -390,20 +436,21 @@ overlapped_CreateEvent(PyObject *self, PyObject *args)
return Py_BuildValue(F_HANDLE, Event);
}
-PyDoc_STRVAR(
- SetEvent_doc,
- "SetEvent(Handle) -> None\n\n"
- "Set event.\n");
+/*[clinic input]
+_overlapped.SetEvent
+
+ Handle: HANDLE
+ /
+
+Set event.
+[clinic start generated code]*/
static PyObject *
-overlapped_SetEvent(PyObject *self, PyObject *args)
+_overlapped_SetEvent_impl(PyObject *module, HANDLE Handle)
+/*[clinic end generated code: output=5b8d974216b0e569 input=d8b0d26eb7391e80]*/
{
- HANDLE Handle;
BOOL ret;
- if (!PyArg_ParseTuple(args, F_HANDLE, &Handle))
- return NULL;
-
Py_BEGIN_ALLOW_THREADS
ret = SetEvent(Handle);
Py_END_ALLOW_THREADS
@@ -413,20 +460,21 @@ overlapped_SetEvent(PyObject *self, PyObject *args)
Py_RETURN_NONE;
}
-PyDoc_STRVAR(
- ResetEvent_doc,
- "ResetEvent(Handle) -> None\n\n"
- "Reset event.\n");
+/*[clinic input]
+_overlapped.ResetEvent
+
+ Handle: HANDLE
+ /
+
+Reset event.
+[clinic start generated code]*/
static PyObject *
-overlapped_ResetEvent(PyObject *self, PyObject *args)
+_overlapped_ResetEvent_impl(PyObject *module, HANDLE Handle)
+/*[clinic end generated code: output=066537a8405cddb2 input=d4e089c9ba84ff2f]*/
{
- HANDLE Handle;
BOOL ret;
- if (!PyArg_ParseTuple(args, F_HANDLE, &Handle))
- return NULL;
-
Py_BEGIN_ALLOW_THREADS
ret = ResetEvent(Handle);
Py_END_ALLOW_THREADS
@@ -440,36 +488,40 @@ overlapped_ResetEvent(PyObject *self, PyObject *args)
* Bind socket handle to local port without doing slow getaddrinfo()
*/
-PyDoc_STRVAR(
- BindLocal_doc,
- "BindLocal(handle, family) -> None\n\n"
- "Bind a socket handle to an arbitrary local port.\n"
- "family should AF_INET or AF_INET6.\n");
+/*[clinic input]
+_overlapped.BindLocal
+
+ handle as Socket: HANDLE
+ family as Family: int
+ /
+
+Bind a socket handle to an arbitrary local port.
+
+family should be AF_INET or AF_INET6.
+[clinic start generated code]*/
static PyObject *
-overlapped_BindLocal(PyObject *self, PyObject *args)
+_overlapped_BindLocal_impl(PyObject *module, HANDLE Socket, int Family)
+/*[clinic end generated code: output=edb93862697aed9c input=a0e7b5c2f541170c]*/
{
- SOCKET Socket;
- int Family;
BOOL ret;
- if (!PyArg_ParseTuple(args, F_HANDLE "i", &Socket, &Family))
- return NULL;
-
if (Family == AF_INET) {
struct sockaddr_in addr;
memset(&addr, 0, sizeof(addr));
addr.sin_family = AF_INET;
addr.sin_port = 0;
addr.sin_addr.S_un.S_addr = INADDR_ANY;
- ret = bind(Socket, (SOCKADDR*)&addr, sizeof(addr)) != SOCKET_ERROR;
+ ret = bind((SOCKET)Socket, (SOCKADDR*)&addr, sizeof(addr))
+ != SOCKET_ERROR;
} else if (Family == AF_INET6) {
struct sockaddr_in6 addr;
memset(&addr, 0, sizeof(addr));
addr.sin6_family = AF_INET6;
addr.sin6_port = 0;
addr.sin6_addr = in6addr_any;
- ret = bind(Socket, (SOCKADDR*)&addr, sizeof(addr)) != SOCKET_ERROR;
+ ret = bind((SOCKET)Socket, (SOCKADDR*)&addr, sizeof(addr))
+ != SOCKET_ERROR;
} else {
PyErr_SetString(PyExc_ValueError, "expected tuple of length 2 or 4");
return NULL;
@@ -484,21 +536,23 @@ overlapped_BindLocal(PyObject *self, PyObject *args)
* Windows equivalent of os.strerror() -- compare _ctypes/callproc.c
*/
-PyDoc_STRVAR(
- FormatMessage_doc,
- "FormatMessage(error_code) -> error_message\n\n"
- "Return error message for an error code.");
+/*[clinic input]
+_overlapped.FormatMessage
+
+ error_code as code: DWORD
+ /
+
+Return error message for an error code.
+[clinic start generated code]*/
static PyObject *
-overlapped_FormatMessage(PyObject *ignore, PyObject *args)
+_overlapped_FormatMessage_impl(PyObject *module, DWORD code)
+/*[clinic end generated code: output=02c964ff22407c6b input=644bb5b80326179e]*/
{
- DWORD code, n;
+ DWORD n;
WCHAR *lpMsgBuf;
PyObject *res;
- if (!PyArg_ParseTuple(args, F_DWORD, &code))
- return NULL;
-
n = FormatMessageW(FORMAT_MESSAGE_ALLOCATE_BUFFER |
FORMAT_MESSAGE_FROM_SYSTEM |
FORMAT_MESSAGE_IGNORE_INSERTS,
@@ -538,19 +592,20 @@ mark_as_completed(OVERLAPPED *ov)
* for overlapped I/O
*/
-PyDoc_STRVAR(
- Overlapped_doc,
- "Overlapped object");
+/*[clinic input]
+@classmethod
+_overlapped.Overlapped.__new__
+
+ event: HANDLE(c_default='INVALID_HANDLE_VALUE') = _overlapped.INVALID_HANDLE_VALUE
+
+OVERLAPPED structure wrapper.
+[clinic start generated code]*/
static PyObject *
-Overlapped_new(PyTypeObject *type, PyObject *args, PyObject *kwds)
+_overlapped_Overlapped_impl(PyTypeObject *type, HANDLE event)
+/*[clinic end generated code: output=6da60504a18eb421 input=26b8a7429e629e95]*/
{
OverlappedObject *self;
- HANDLE event = INVALID_HANDLE_VALUE;
- static char *kwlist[] = {"event", NULL};
-
- if (!PyArg_ParseTupleAndKeywords(args, kwds, "|" F_HANDLE, kwlist, &event))
- return NULL;
if (event == INVALID_HANDLE_VALUE) {
event = CreateEvent(NULL, TRUE, FALSE, NULL);
@@ -720,13 +775,15 @@ unparse_address(LPSOCKADDR Address, DWORD Length)
}
}
-PyDoc_STRVAR(
- Overlapped_cancel_doc,
- "cancel() -> None\n\n"
- "Cancel overlapped operation");
+/*[clinic input]
+_overlapped.Overlapped.cancel
+
+Cancel overlapped operation.
+[clinic start generated code]*/
static PyObject *
-Overlapped_cancel(OverlappedObject *self, PyObject *Py_UNUSED(ignored))
+_overlapped_Overlapped_cancel_impl(OverlappedObject *self)
+/*[clinic end generated code: output=54ad7aeece89901c input=80eb67c7b57dbcf1]*/
{
BOOL ret = TRUE;
@@ -749,25 +806,27 @@ Overlapped_cancel(OverlappedObject *self, PyObject *Py_UNUSED(ignored))
Py_RETURN_NONE;
}
-PyDoc_STRVAR(
- Overlapped_getresult_doc,
- "getresult(wait=False) -> result\n\n"
- "Retrieve result of operation. If wait is true then it blocks\n"
- "until the operation is finished. If wait is false and the\n"
- "operation is still pending then an error is raised.");
+/*[clinic input]
+_overlapped.Overlapped.getresult
+
+ wait: BOOL(c_default='FALSE') = False
+ /
+
+Retrieve result of operation.
+
+If wait is true then it blocks until the operation is finished. If wait
+is false and the operation is still pending then an error is raised.
+[clinic start generated code]*/
static PyObject *
-Overlapped_getresult(OverlappedObject *self, PyObject *args)
+_overlapped_Overlapped_getresult_impl(OverlappedObject *self, BOOL wait)
+/*[clinic end generated code: output=8c9bd04d08994f6c input=aa5b03e9897ca074]*/
{
- BOOL wait = FALSE;
DWORD transferred = 0;
BOOL ret;
DWORD err;
PyObject *addr;
- if (!PyArg_ParseTuple(args, "|" F_BOOL, &wait))
- return NULL;
-
if (self->type == TYPE_NONE) {
PyErr_SetString(PyExc_ValueError, "operation not yet attempted");
return NULL;
@@ -879,21 +938,23 @@ do_ReadFile(OverlappedObject *self, HANDLE handle,
}
}
-PyDoc_STRVAR(
- Overlapped_ReadFile_doc,
- "ReadFile(handle, size) -> Overlapped[message]\n\n"
- "Start overlapped read");
+/*[clinic input]
+_overlapped.Overlapped.ReadFile
+
+ handle: HANDLE
+ size: DWORD
+ /
+
+Start overlapped read.
+[clinic start generated code]*/
static PyObject *
-Overlapped_ReadFile(OverlappedObject *self, PyObject *args)
+_overlapped_Overlapped_ReadFile_impl(OverlappedObject *self, HANDLE handle,
+ DWORD size)
+/*[clinic end generated code: output=4c8557e16941e4ae input=98c495baa0342425]*/
{
- HANDLE handle;
- DWORD size;
PyObject *buf;
- if (!PyArg_ParseTuple(args, F_HANDLE F_DWORD, &handle, &size))
- return NULL;
-
if (self->type != TYPE_NONE) {
PyErr_SetString(PyExc_ValueError, "operation already attempted");
return NULL;
@@ -913,20 +974,21 @@ Overlapped_ReadFile(OverlappedObject *self, PyObject *args)
return do_ReadFile(self, handle, PyBytes_AS_STRING(buf), size);
}
-PyDoc_STRVAR(
- Overlapped_ReadFileInto_doc,
- "ReadFileInto(handle, buf) -> Overlapped[bytes_transferred]\n\n"
- "Start overlapped receive");
+/*[clinic input]
+_overlapped.Overlapped.ReadFileInto
-static PyObject *
-Overlapped_ReadFileInto(OverlappedObject *self, PyObject *args)
-{
- HANDLE handle;
- PyObject *bufobj;
+ handle: HANDLE
+ buf as bufobj: object
+ /
- if (!PyArg_ParseTuple(args, F_HANDLE "O", &handle, &bufobj))
- return NULL;
+Start overlapped receive.
+[clinic start generated code]*/
+static PyObject *
+_overlapped_Overlapped_ReadFileInto_impl(OverlappedObject *self,
+ HANDLE handle, PyObject *bufobj)
+/*[clinic end generated code: output=1e9e712e742e5b2a input=16f6cc268d1d0387]*/
+{
if (self->type != TYPE_NONE) {
PyErr_SetString(PyExc_ValueError, "operation already attempted");
return NULL;
@@ -982,23 +1044,24 @@ do_WSARecv(OverlappedObject *self, HANDLE handle,
}
}
-PyDoc_STRVAR(
- Overlapped_WSARecv_doc,
- "RecvFile(handle, size, flags) -> Overlapped[message]\n\n"
- "Start overlapped receive");
+/*[clinic input]
+_overlapped.Overlapped.WSARecv
+
+ handle: HANDLE
+ size: DWORD
+ flags: DWORD = 0
+ /
+
+Start overlapped receive.
+[clinic start generated code]*/
static PyObject *
-Overlapped_WSARecv(OverlappedObject *self, PyObject *args)
+_overlapped_Overlapped_WSARecv_impl(OverlappedObject *self, HANDLE handle,
+ DWORD size, DWORD flags)
+/*[clinic end generated code: output=3a5e9c61ff040906 input=8c04e506cc3d741a]*/
{
- HANDLE handle;
- DWORD size;
- DWORD flags = 0;
PyObject *buf;
- if (!PyArg_ParseTuple(args, F_HANDLE F_DWORD "|" F_DWORD,
- &handle, &size, &flags))
- return NULL;
-
if (self->type != TYPE_NONE) {
PyErr_SetString(PyExc_ValueError, "operation already attempted");
return NULL;
@@ -1018,22 +1081,23 @@ Overlapped_WSARecv(OverlappedObject *self, PyObject *args)
return do_WSARecv(self, handle, PyBytes_AS_STRING(buf), size, flags);
}
-PyDoc_STRVAR(
- Overlapped_WSARecvInto_doc,
- "WSARecvInto(handle, buf, flags) -> Overlapped[bytes_transferred]\n\n"
- "Start overlapped receive");
+/*[clinic input]
+_overlapped.Overlapped.WSARecvInto
-static PyObject *
-Overlapped_WSARecvInto(OverlappedObject *self, PyObject *args)
-{
- HANDLE handle;
- PyObject *bufobj;
- DWORD flags;
+ handle: HANDLE
+ buf as bufobj: object
+ flags: DWORD
+ /
- if (!PyArg_ParseTuple(args, F_HANDLE "O" F_DWORD,
- &handle, &bufobj, &flags))
- return NULL;
+Start overlapped receive.
+[clinic start generated code]*/
+static PyObject *
+_overlapped_Overlapped_WSARecvInto_impl(OverlappedObject *self,
+ HANDLE handle, PyObject *bufobj,
+ DWORD flags)
+/*[clinic end generated code: output=9a438abc436fe87c input=4f87c38fc381d525]*/
+{
if (self->type != TYPE_NONE) {
PyErr_SetString(PyExc_ValueError, "operation already attempted");
return NULL;
@@ -1057,23 +1121,25 @@ Overlapped_WSARecvInto(OverlappedObject *self, PyObject *args)
(DWORD)self->user_buffer.len, flags);
}
-PyDoc_STRVAR(
- Overlapped_WriteFile_doc,
- "WriteFile(handle, buf) -> Overlapped[bytes_transferred]\n\n"
- "Start overlapped write");
+/*[clinic input]
+_overlapped.Overlapped.WriteFile
+
+ handle: HANDLE
+ buf as bufobj: object
+ /
+
+Start overlapped write.
+[clinic start generated code]*/
static PyObject *
-Overlapped_WriteFile(OverlappedObject *self, PyObject *args)
+_overlapped_Overlapped_WriteFile_impl(OverlappedObject *self, HANDLE handle,
+ PyObject *bufobj)
+/*[clinic end generated code: output=c376230b6120d877 input=b8d9a7608d8a1e72]*/
{
- HANDLE handle;
- PyObject *bufobj;
DWORD written;
BOOL ret;
DWORD err;
- if (!PyArg_ParseTuple(args, F_HANDLE "O", &handle, &bufobj))
- return NULL;
-
if (self->type != TYPE_NONE) {
PyErr_SetString(PyExc_ValueError, "operation already attempted");
return NULL;
@@ -1110,26 +1176,27 @@ Overlapped_WriteFile(OverlappedObject *self, PyObject *args)
}
}
-PyDoc_STRVAR(
- Overlapped_WSASend_doc,
- "WSASend(handle, buf, flags) -> Overlapped[bytes_transferred]\n\n"
- "Start overlapped send");
+/*[clinic input]
+_overlapped.Overlapped.WSASend
+
+ handle: HANDLE
+ buf as bufobj: object
+ flags: DWORD
+ /
+
+Start overlapped send.
+[clinic start generated code]*/
static PyObject *
-Overlapped_WSASend(OverlappedObject *self, PyObject *args)
+_overlapped_Overlapped_WSASend_impl(OverlappedObject *self, HANDLE handle,
+ PyObject *bufobj, DWORD flags)
+/*[clinic end generated code: output=316031c7467040cc input=932e7cba6d18f708]*/
{
- HANDLE handle;
- PyObject *bufobj;
- DWORD flags;
DWORD written;
WSABUF wsabuf;
int ret;
DWORD err;
- if (!PyArg_ParseTuple(args, F_HANDLE "O" F_DWORD,
- &handle, &bufobj, &flags))
- return NULL;
-
if (self->type != TYPE_NONE) {
PyErr_SetString(PyExc_ValueError, "operation already attempted");
return NULL;
@@ -1167,26 +1234,28 @@ Overlapped_WSASend(OverlappedObject *self, PyObject *args)
}
}
-PyDoc_STRVAR(
- Overlapped_AcceptEx_doc,
- "AcceptEx(listen_handle, accept_handle) -> Overlapped[address_as_bytes]\n\n"
- "Start overlapped wait for client to connect");
+/*[clinic input]
+_overlapped.Overlapped.AcceptEx
+
+ listen_handle as ListenSocket: HANDLE
+ accept_handle as AcceptSocket: HANDLE
+ /
+
+Start overlapped wait for client to connect.
+[clinic start generated code]*/
static PyObject *
-Overlapped_AcceptEx(OverlappedObject *self, PyObject *args)
+_overlapped_Overlapped_AcceptEx_impl(OverlappedObject *self,
+ HANDLE ListenSocket,
+ HANDLE AcceptSocket)
+/*[clinic end generated code: output=9a7381d4232af889 input=b83473224fc3a1c5]*/
{
- SOCKET ListenSocket;
- SOCKET AcceptSocket;
DWORD BytesReceived;
DWORD size;
PyObject *buf;
BOOL ret;
DWORD err;
- if (!PyArg_ParseTuple(args, F_HANDLE F_HANDLE,
- &ListenSocket, &AcceptSocket))
- return NULL;
-
if (self->type != TYPE_NONE) {
PyErr_SetString(PyExc_ValueError, "operation already attempted");
return NULL;
@@ -1198,12 +1267,13 @@ Overlapped_AcceptEx(OverlappedObject *self, PyObject *args)
return NULL;
self->type = TYPE_ACCEPT;
- self->handle = (HANDLE)ListenSocket;
+ self->handle = ListenSocket;
self->allocated_buffer = buf;
Py_BEGIN_ALLOW_THREADS
- ret = Py_AcceptEx(ListenSocket, AcceptSocket, PyBytes_AS_STRING(buf),
- 0, size, size, &BytesReceived, &self->overlapped);
+ ret = Py_AcceptEx((SOCKET)ListenSocket, (SOCKET)AcceptSocket,
+ PyBytes_AS_STRING(buf), 0, size, size, &BytesReceived,
+ &self->overlapped);
Py_END_ALLOW_THREADS
self->error = err = ret ? ERROR_SUCCESS : WSAGetLastError();
@@ -1257,28 +1327,30 @@ parse_address(PyObject *obj, SOCKADDR *Address, int Length)
return -1;
}
-PyDoc_STRVAR(
- Overlapped_ConnectEx_doc,
- "ConnectEx(client_handle, address_as_bytes) -> Overlapped[None]\n\n"
- "Start overlapped connect. client_handle should be unbound.");
+/*[clinic input]
+_overlapped.Overlapped.ConnectEx
+
+ client_handle as ConnectSocket: HANDLE
+ address_as_bytes as AddressObj: object(subclass_of='&PyTuple_Type')
+ /
+
+Start overlapped connect.
+
+client_handle should be unbound.
+[clinic start generated code]*/
static PyObject *
-Overlapped_ConnectEx(OverlappedObject *self, PyObject *args)
+_overlapped_Overlapped_ConnectEx_impl(OverlappedObject *self,
+ HANDLE ConnectSocket,
+ PyObject *AddressObj)
+/*[clinic end generated code: output=5aebbbdb4f022833 input=d6bbd2d84b156fc1]*/
{
- SOCKET ConnectSocket;
- PyObject *AddressObj;
char AddressBuf[sizeof(struct sockaddr_in6)];
SOCKADDR *Address = (SOCKADDR*)AddressBuf;
int Length;
BOOL ret;
DWORD err;
- if (!PyArg_ParseTuple(args, F_HANDLE "O!:ConnectEx",
- &ConnectSocket, &PyTuple_Type, &AddressObj))
- {
- return NULL;
- }
-
if (self->type != TYPE_NONE) {
PyErr_SetString(PyExc_ValueError, "operation already attempted");
return NULL;
@@ -1290,10 +1362,10 @@ Overlapped_ConnectEx(OverlappedObject *self, PyObject *args)
return NULL;
self->type = TYPE_CONNECT;
- self->handle = (HANDLE)ConnectSocket;
+ self->handle = ConnectSocket;
Py_BEGIN_ALLOW_THREADS
- ret = Py_ConnectEx(ConnectSocket, Address, Length,
+ ret = Py_ConnectEx((SOCKET)ConnectSocket, Address, Length,
NULL, 0, NULL, &self->overlapped);
Py_END_ALLOW_THREADS
@@ -1308,32 +1380,33 @@ Overlapped_ConnectEx(OverlappedObject *self, PyObject *args)
}
}
-PyDoc_STRVAR(
- Overlapped_DisconnectEx_doc,
- "DisconnectEx(handle, flags) -> Overlapped[None]\n\n"
- "Start overlapped connect. client_handle should be unbound.");
+/*[clinic input]
+_overlapped.Overlapped.DisconnectEx
+
+ handle as Socket: HANDLE
+ flags: DWORD
+ /
+
+[clinic start generated code]*/
static PyObject *
-Overlapped_DisconnectEx(OverlappedObject *self, PyObject *args)
+_overlapped_Overlapped_DisconnectEx_impl(OverlappedObject *self,
+ HANDLE Socket, DWORD flags)
+/*[clinic end generated code: output=8d64ddb8c93c2126 input=680845cdcdf820eb]*/
{
- SOCKET Socket;
- DWORD flags;
BOOL ret;
DWORD err;
- if (!PyArg_ParseTuple(args, F_HANDLE F_DWORD, &Socket, &flags))
- return NULL;
-
if (self->type != TYPE_NONE) {
PyErr_SetString(PyExc_ValueError, "operation already attempted");
return NULL;
}
self->type = TYPE_DISCONNECT;
- self->handle = (HANDLE)Socket;
+ self->handle = Socket;
Py_BEGIN_ALLOW_THREADS
- ret = Py_DisconnectEx(Socket, &self->overlapped, flags, 0);
+ ret = Py_DisconnectEx((SOCKET)Socket, &self->overlapped, flags, 0);
Py_END_ALLOW_THREADS
self->error = err = ret ? ERROR_SUCCESS : WSAGetLastError();
@@ -1347,48 +1420,45 @@ Overlapped_DisconnectEx(OverlappedObject *self, PyObject *args)
}
}
-PyDoc_STRVAR(
- Overlapped_TransmitFile_doc,
- "TransmitFile(socket, file, offset, offset_high, "
- "count_to_write, count_per_send, flags) "
- "-> Overlapped[None]\n\n"
- "Transmit file data over a connected socket.");
+/*[clinic input]
+_overlapped.Overlapped.TransmitFile
+
+ socket as Socket: HANDLE
+ file as File: HANDLE
+ offset: DWORD
+ offset_high: DWORD
+ count_to_write: DWORD
+ count_per_send: DWORD
+ flags: DWORD
+ /
+
+Transmit file data over a connected socket.
+[clinic start generated code]*/
static PyObject *
-Overlapped_TransmitFile(OverlappedObject *self, PyObject *args)
+_overlapped_Overlapped_TransmitFile_impl(OverlappedObject *self,
+ HANDLE Socket, HANDLE File,
+ DWORD offset, DWORD offset_high,
+ DWORD count_to_write,
+ DWORD count_per_send, DWORD flags)
+/*[clinic end generated code: output=03f3ca5512e678fd input=7e6f97b391f60e8c]*/
{
- SOCKET Socket;
- HANDLE File;
- DWORD offset;
- DWORD offset_high;
- DWORD count_to_write;
- DWORD count_per_send;
- DWORD flags;
BOOL ret;
DWORD err;
- if (!PyArg_ParseTuple(args,
- F_HANDLE F_HANDLE F_DWORD F_DWORD
- F_DWORD F_DWORD F_DWORD,
- &Socket, &File, &offset, &offset_high,
- &count_to_write, &count_per_send,
- &flags))
- return NULL;
-
if (self->type != TYPE_NONE) {
PyErr_SetString(PyExc_ValueError, "operation already attempted");
return NULL;
}
self->type = TYPE_TRANSMIT_FILE;
- self->handle = (HANDLE)Socket;
+ self->handle = Socket;
self->overlapped.Offset = offset;
self->overlapped.OffsetHigh = offset_high;
Py_BEGIN_ALLOW_THREADS
- ret = Py_TransmitFile(Socket, File, count_to_write, count_per_send,
- &self->overlapped,
- NULL, flags);
+ ret = Py_TransmitFile((SOCKET)Socket, File, count_to_write,
+ count_per_send, &self->overlapped, NULL, flags);
Py_END_ALLOW_THREADS
self->error = err = ret ? ERROR_SUCCESS : WSAGetLastError();
@@ -1402,21 +1472,23 @@ Overlapped_TransmitFile(OverlappedObject *self, PyObject *args)
}
}
-PyDoc_STRVAR(
- Overlapped_ConnectNamedPipe_doc,
- "ConnectNamedPipe(handle) -> Overlapped[None]\n\n"
- "Start overlapped wait for a client to connect.");
+/*[clinic input]
+_overlapped.Overlapped.ConnectNamedPipe
+
+ handle as Pipe: HANDLE
+ /
+
+Start overlapped wait for a client to connect.
+[clinic start generated code]*/
static PyObject *
-Overlapped_ConnectNamedPipe(OverlappedObject *self, PyObject *args)
+_overlapped_Overlapped_ConnectNamedPipe_impl(OverlappedObject *self,
+ HANDLE Pipe)
+/*[clinic end generated code: output=3e69adfe55818abe input=8b0d4cef8a72f7bc]*/
{
- HANDLE Pipe;
BOOL ret;
DWORD err;
- if (!PyArg_ParseTuple(args, F_HANDLE, &Pipe))
- return NULL;
-
if (self->type != TYPE_NONE) {
PyErr_SetString(PyExc_ValueError, "operation already attempted");
return NULL;
@@ -1443,25 +1515,22 @@ Overlapped_ConnectNamedPipe(OverlappedObject *self, PyObject *args)
}
}
-PyDoc_STRVAR(
- ConnectPipe_doc,
- "ConnectPipe(addr) -> pipe_handle\n\n"
- "Connect to the pipe for asynchronous I/O (overlapped).");
+/*[clinic input]
+_overlapped.Overlapped.ConnectPipe
+
+ addr as Address: Py_UNICODE
+ /
+
+Connect to the pipe for asynchronous I/O (overlapped).
+[clinic start generated code]*/
static PyObject *
-overlapped_ConnectPipe(PyObject *self, PyObject *args)
+_overlapped_Overlapped_ConnectPipe_impl(OverlappedObject *self,
+ const Py_UNICODE *Address)
+/*[clinic end generated code: output=3cc9661667d459d4 input=167c06a274efcefc]*/
{
- PyObject *AddressObj;
- wchar_t *Address;
HANDLE PipeHandle;
- if (!PyArg_ParseTuple(args, "U", &AddressObj))
- return NULL;
-
- Address = PyUnicode_AsWideCharString(AddressObj, NULL);
- if (Address == NULL)
- return NULL;
-
Py_BEGIN_ALLOW_THREADS
PipeHandle = CreateFileW(Address,
GENERIC_READ | GENERIC_WRITE,
@@ -1469,7 +1538,6 @@ overlapped_ConnectPipe(PyObject *self, PyObject *args)
FILE_FLAG_OVERLAPPED, NULL);
Py_END_ALLOW_THREADS
- PyMem_Free(Address);
if (PipeHandle == INVALID_HANDLE_VALUE)
return SetFromWindowsErr(0);
return Py_BuildValue(F_HANDLE, PipeHandle);
@@ -1512,29 +1580,31 @@ Overlapped_traverse(OverlappedObject *self, visitproc visit, void *arg)
// UDP functions
-PyDoc_STRVAR(
- WSAConnect_doc,
- "WSAConnect(client_handle, address_as_bytes) -> Overlapped[None]\n\n"
- "Bind a remote address to a connectionless (UDP) socket");
-
/*
* Note: WSAConnect does not support Overlapped I/O so this function should
* _only_ be used for connectionless sockets (UDP).
*/
+
+/*[clinic input]
+_overlapped.WSAConnect
+
+ client_handle as ConnectSocket: HANDLE
+ address_as_bytes as AddressObj: object
+ /
+
+Bind a remote address to a connectionless (UDP) socket.
+[clinic start generated code]*/
+
static PyObject *
-overlapped_WSAConnect(PyObject *self, PyObject *args)
+_overlapped_WSAConnect_impl(PyObject *module, HANDLE ConnectSocket,
+ PyObject *AddressObj)
+/*[clinic end generated code: output=ea0b4391e94dad63 input=169f8075e9ae7fa4]*/
{
- SOCKET ConnectSocket;
- PyObject *AddressObj;
char AddressBuf[sizeof(struct sockaddr_in6)];
SOCKADDR *Address = (SOCKADDR*)AddressBuf;
int Length;
int err;
- if (!PyArg_ParseTuple(args, F_HANDLE "O", &ConnectSocket, &AddressObj)) {
- return NULL;
- }
-
Length = sizeof(AddressBuf);
Length = parse_address(AddressObj, Address, Length);
if (Length < 0) {
@@ -1544,7 +1614,7 @@ overlapped_WSAConnect(PyObject *self, PyObject *args)
Py_BEGIN_ALLOW_THREADS
// WSAConnect does not support overlapped I/O so this call will
// successfully complete immediately.
- err = WSAConnect(ConnectSocket, Address, Length,
+ err = WSAConnect((SOCKET)ConnectSocket, Address, Length,
NULL, NULL, NULL, NULL);
Py_END_ALLOW_THREADS
@@ -1556,19 +1626,24 @@ overlapped_WSAConnect(PyObject *self, PyObject *args)
}
}
-PyDoc_STRVAR(
- Overlapped_WSASendTo_doc,
- "WSASendTo(handle, buf, flags, address_as_bytes) -> "
- "Overlapped[bytes_transferred]\n\n"
- "Start overlapped sendto over a connectionless (UDP) socket");
+/*[clinic input]
+_overlapped.Overlapped.WSASendTo
+
+ handle: HANDLE
+ buf as bufobj: object
+ flags: DWORD
+ address_as_bytes as AddressObj: object
+ /
+
+Start overlapped sendto over a connectionless (UDP) socket.
+[clinic start generated code]*/
static PyObject *
-Overlapped_WSASendTo(OverlappedObject *self, PyObject *args)
+_overlapped_Overlapped_WSASendTo_impl(OverlappedObject *self, HANDLE handle,
+ PyObject *bufobj, DWORD flags,
+ PyObject *AddressObj)
+/*[clinic end generated code: output=fe0ff55eb60d65e1 input=f709e6ecebd9bc18]*/
{
- HANDLE handle;
- PyObject *bufobj;
- DWORD flags;
- PyObject *AddressObj;
char AddressBuf[sizeof(struct sockaddr_in6)];
SOCKADDR *Address = (SOCKADDR*)AddressBuf;
int AddressLength;
@@ -1577,12 +1652,6 @@ Overlapped_WSASendTo(OverlappedObject *self, PyObject *args)
int ret;
DWORD err;
- if (!PyArg_ParseTuple(args, F_HANDLE "O" F_DWORD "O",
- &handle, &bufobj, &flags, &AddressObj))
- {
- return NULL;
- }
-
// Parse the "to" address
AddressLength = sizeof(AddressBuf);
AddressLength = parse_address(AddressObj, Address, AddressLength);
@@ -1637,24 +1706,29 @@ PyDoc_STRVAR(
"RecvFile(handle, size, flags) -> Overlapped[(message, (host, port))]\n\n"
"Start overlapped receive");
+/*[clinic input]
+_overlapped.Overlapped.WSARecvFrom
+
+ handle: HANDLE
+ size: DWORD
+ flags: DWORD = 0
+ /
+
+Start overlapped receive.
+[clinic start generated code]*/
+
static PyObject *
-Overlapped_WSARecvFrom(OverlappedObject *self, PyObject *args)
+_overlapped_Overlapped_WSARecvFrom_impl(OverlappedObject *self,
+ HANDLE handle, DWORD size,
+ DWORD flags)
+/*[clinic end generated code: output=13832a2025b86860 input=1b2663fa130e0286]*/
{
- HANDLE handle;
- DWORD size;
- DWORD flags = 0;
DWORD nread;
PyObject *buf;
WSABUF wsabuf;
int ret;
DWORD err;
- if (!PyArg_ParseTuple(args, F_HANDLE F_DWORD "|" F_DWORD,
- &handle, &size, &flags))
- {
- return NULL;
- }
-
if (self->type != TYPE_NONE) {
PyErr_SetString(PyExc_ValueError, "operation already attempted");
return NULL;
@@ -1700,38 +1774,24 @@ Overlapped_WSARecvFrom(OverlappedObject *self, PyObject *args)
}
}
+#include "clinic/overlapped.c.h"
static PyMethodDef Overlapped_methods[] = {
- {"getresult", (PyCFunction) Overlapped_getresult,
- METH_VARARGS, Overlapped_getresult_doc},
- {"cancel", (PyCFunction) Overlapped_cancel,
- METH_NOARGS, Overlapped_cancel_doc},
- {"ReadFile", (PyCFunction) Overlapped_ReadFile,
- METH_VARARGS, Overlapped_ReadFile_doc},
- {"ReadFileInto", (PyCFunction) Overlapped_ReadFileInto,
- METH_VARARGS, Overlapped_ReadFileInto_doc},
- {"WSARecv", (PyCFunction) Overlapped_WSARecv,
- METH_VARARGS, Overlapped_WSARecv_doc},
- {"WSARecvInto", (PyCFunction) Overlapped_WSARecvInto,
- METH_VARARGS, Overlapped_WSARecvInto_doc},
- {"WriteFile", (PyCFunction) Overlapped_WriteFile,
- METH_VARARGS, Overlapped_WriteFile_doc},
- {"WSASend", (PyCFunction) Overlapped_WSASend,
- METH_VARARGS, Overlapped_WSASend_doc},
- {"AcceptEx", (PyCFunction) Overlapped_AcceptEx,
- METH_VARARGS, Overlapped_AcceptEx_doc},
- {"ConnectEx", (PyCFunction) Overlapped_ConnectEx,
- METH_VARARGS, Overlapped_ConnectEx_doc},
- {"DisconnectEx", (PyCFunction) Overlapped_DisconnectEx,
- METH_VARARGS, Overlapped_DisconnectEx_doc},
- {"TransmitFile", (PyCFunction) Overlapped_TransmitFile,
- METH_VARARGS, Overlapped_TransmitFile_doc},
- {"ConnectNamedPipe", (PyCFunction) Overlapped_ConnectNamedPipe,
- METH_VARARGS, Overlapped_ConnectNamedPipe_doc},
- {"WSARecvFrom", (PyCFunction) Overlapped_WSARecvFrom,
- METH_VARARGS, Overlapped_WSARecvFrom_doc },
- {"WSASendTo", (PyCFunction) Overlapped_WSASendTo,
- METH_VARARGS, Overlapped_WSASendTo_doc },
+ _OVERLAPPED_OVERLAPPED_GETRESULT_METHODDEF
+ _OVERLAPPED_OVERLAPPED_CANCEL_METHODDEF
+ _OVERLAPPED_OVERLAPPED_READFILE_METHODDEF
+ _OVERLAPPED_OVERLAPPED_READFILEINTO_METHODDEF
+ _OVERLAPPED_OVERLAPPED_WSARECV_METHODDEF
+ _OVERLAPPED_OVERLAPPED_WSARECVINTO_METHODDEF
+ _OVERLAPPED_OVERLAPPED_WRITEFILE_METHODDEF
+ _OVERLAPPED_OVERLAPPED_WSASEND_METHODDEF
+ _OVERLAPPED_OVERLAPPED_ACCEPTEX_METHODDEF
+ _OVERLAPPED_OVERLAPPED_CONNECTEX_METHODDEF
+ _OVERLAPPED_OVERLAPPED_DISCONNECTEX_METHODDEF
+ _OVERLAPPED_OVERLAPPED_TRANSMITFILE_METHODDEF
+ _OVERLAPPED_OVERLAPPED_CONNECTNAMEDPIPE_METHODDEF
+ _OVERLAPPED_OVERLAPPED_WSARECVFROM_METHODDEF
+ _OVERLAPPED_OVERLAPPED_WSASENDTO_METHODDEF
{NULL}
};
@@ -1774,7 +1834,7 @@ PyTypeObject OverlappedType = {
/* tp_setattro */ 0,
/* tp_as_buffer */ 0,
/* tp_flags */ Py_TPFLAGS_DEFAULT,
- /* tp_doc */ "OVERLAPPED structure wrapper",
+ /* tp_doc */ _overlapped_Overlapped__doc__,
/* tp_traverse */ (traverseproc)Overlapped_traverse,
/* tp_clear */ 0,
/* tp_richcompare */ 0,
@@ -1791,36 +1851,23 @@ PyTypeObject OverlappedType = {
/* tp_dictoffset */ 0,
/* tp_init */ 0,
/* tp_alloc */ 0,
- /* tp_new */ Overlapped_new,
+ /* tp_new */ _overlapped_Overlapped,
};
static PyMethodDef overlapped_functions[] = {
- {"CreateIoCompletionPort", overlapped_CreateIoCompletionPort,
- METH_VARARGS, CreateIoCompletionPort_doc},
- {"GetQueuedCompletionStatus", overlapped_GetQueuedCompletionStatus,
- METH_VARARGS, GetQueuedCompletionStatus_doc},
- {"PostQueuedCompletionStatus", overlapped_PostQueuedCompletionStatus,
- METH_VARARGS, PostQueuedCompletionStatus_doc},
- {"FormatMessage", overlapped_FormatMessage,
- METH_VARARGS, FormatMessage_doc},
- {"BindLocal", overlapped_BindLocal,
- METH_VARARGS, BindLocal_doc},
- {"RegisterWaitWithQueue", overlapped_RegisterWaitWithQueue,
- METH_VARARGS, RegisterWaitWithQueue_doc},
- {"UnregisterWait", overlapped_UnregisterWait,
- METH_VARARGS, UnregisterWait_doc},
- {"UnregisterWaitEx", overlapped_UnregisterWaitEx,
- METH_VARARGS, UnregisterWaitEx_doc},
- {"CreateEvent", overlapped_CreateEvent,
- METH_VARARGS, CreateEvent_doc},
- {"SetEvent", overlapped_SetEvent,
- METH_VARARGS, SetEvent_doc},
- {"ResetEvent", overlapped_ResetEvent,
- METH_VARARGS, ResetEvent_doc},
- {"ConnectPipe", overlapped_ConnectPipe,
- METH_VARARGS, ConnectPipe_doc},
- {"WSAConnect", overlapped_WSAConnect,
- METH_VARARGS, WSAConnect_doc},
+ _OVERLAPPED_CREATEIOCOMPLETIONPORT_METHODDEF
+ _OVERLAPPED_GETQUEUEDCOMPLETIONSTATUS_METHODDEF
+ _OVERLAPPED_POSTQUEUEDCOMPLETIONSTATUS_METHODDEF
+ _OVERLAPPED_FORMATMESSAGE_METHODDEF
+ _OVERLAPPED_BINDLOCAL_METHODDEF
+ _OVERLAPPED_REGISTERWAITWITHQUEUE_METHODDEF
+ _OVERLAPPED_UNREGISTERWAIT_METHODDEF
+ _OVERLAPPED_UNREGISTERWAITEX_METHODDEF
+ _OVERLAPPED_CREATEEVENT_METHODDEF
+ _OVERLAPPED_SETEVENT_METHODDEF
+ _OVERLAPPED_RESETEVENT_METHODDEF
+ _OVERLAPPED_OVERLAPPED_CONNECTPIPE_METHODDEF
+ _OVERLAPPED_WSACONNECT_METHODDEF
{NULL}
};