summaryrefslogtreecommitdiffstats
path: root/Modules/clinic
diff options
context:
space:
mode:
authorAndrew Svetlov <andrew.svetlov@gmail.com>2022-03-13 21:28:45 (GMT)
committerGitHub <noreply@github.com>2022-03-13 21:28:45 (GMT)
commit690490e4de9f2baf07171b3d63fc440239928fb4 (patch)
tree4aac5e295596357132b79395f8180592a13b083b /Modules/clinic
parentb1e286860742e7ba6fadc75e3ddb6c2899a56919 (diff)
downloadcpython-690490e4de9f2baf07171b3d63fc440239928fb4.zip
cpython-690490e4de9f2baf07171b3d63fc440239928fb4.tar.gz
cpython-690490e4de9f2baf07171b3d63fc440239928fb4.tar.bz2
bpo-47003: Cleanup _overlapped module (GH-31848)
Diffstat (limited to 'Modules/clinic')
-rw-r--r--Modules/clinic/overlapped.c.h67
1 files changed, 46 insertions, 21 deletions
diff --git a/Modules/clinic/overlapped.c.h b/Modules/clinic/overlapped.c.h
index 16d6013..7e81fc8 100644
--- a/Modules/clinic/overlapped.c.h
+++ b/Modules/clinic/overlapped.c.h
@@ -466,22 +466,27 @@ PyDoc_STRVAR(_overlapped_Overlapped_ReadFileInto__doc__,
static PyObject *
_overlapped_Overlapped_ReadFileInto_impl(OverlappedObject *self,
- HANDLE handle, PyObject *bufobj);
+ HANDLE handle, Py_buffer *bufobj);
static PyObject *
_overlapped_Overlapped_ReadFileInto(OverlappedObject *self, PyObject *const *args, Py_ssize_t nargs)
{
PyObject *return_value = NULL;
HANDLE handle;
- PyObject *bufobj;
+ Py_buffer bufobj = {NULL, NULL};
- if (!_PyArg_ParseStack(args, nargs, ""F_HANDLE"O:ReadFileInto",
+ if (!_PyArg_ParseStack(args, nargs, ""F_HANDLE"y*:ReadFileInto",
&handle, &bufobj)) {
goto exit;
}
- return_value = _overlapped_Overlapped_ReadFileInto_impl(self, handle, bufobj);
+ return_value = _overlapped_Overlapped_ReadFileInto_impl(self, handle, &bufobj);
exit:
+ /* Cleanup for bufobj */
+ if (bufobj.obj) {
+ PyBuffer_Release(&bufobj);
+ }
+
return return_value;
}
@@ -527,7 +532,7 @@ PyDoc_STRVAR(_overlapped_Overlapped_WSARecvInto__doc__,
static PyObject *
_overlapped_Overlapped_WSARecvInto_impl(OverlappedObject *self,
- HANDLE handle, PyObject *bufobj,
+ HANDLE handle, Py_buffer *bufobj,
DWORD flags);
static PyObject *
@@ -535,16 +540,21 @@ _overlapped_Overlapped_WSARecvInto(OverlappedObject *self, PyObject *const *args
{
PyObject *return_value = NULL;
HANDLE handle;
- PyObject *bufobj;
+ Py_buffer bufobj = {NULL, NULL};
DWORD flags;
- if (!_PyArg_ParseStack(args, nargs, ""F_HANDLE"Ok:WSARecvInto",
+ if (!_PyArg_ParseStack(args, nargs, ""F_HANDLE"y*k:WSARecvInto",
&handle, &bufobj, &flags)) {
goto exit;
}
- return_value = _overlapped_Overlapped_WSARecvInto_impl(self, handle, bufobj, flags);
+ return_value = _overlapped_Overlapped_WSARecvInto_impl(self, handle, &bufobj, flags);
exit:
+ /* Cleanup for bufobj */
+ if (bufobj.obj) {
+ PyBuffer_Release(&bufobj);
+ }
+
return return_value;
}
@@ -559,22 +569,27 @@ PyDoc_STRVAR(_overlapped_Overlapped_WriteFile__doc__,
static PyObject *
_overlapped_Overlapped_WriteFile_impl(OverlappedObject *self, HANDLE handle,
- PyObject *bufobj);
+ Py_buffer *bufobj);
static PyObject *
_overlapped_Overlapped_WriteFile(OverlappedObject *self, PyObject *const *args, Py_ssize_t nargs)
{
PyObject *return_value = NULL;
HANDLE handle;
- PyObject *bufobj;
+ Py_buffer bufobj = {NULL, NULL};
- if (!_PyArg_ParseStack(args, nargs, ""F_HANDLE"O:WriteFile",
+ if (!_PyArg_ParseStack(args, nargs, ""F_HANDLE"y*:WriteFile",
&handle, &bufobj)) {
goto exit;
}
- return_value = _overlapped_Overlapped_WriteFile_impl(self, handle, bufobj);
+ return_value = _overlapped_Overlapped_WriteFile_impl(self, handle, &bufobj);
exit:
+ /* Cleanup for bufobj */
+ if (bufobj.obj) {
+ PyBuffer_Release(&bufobj);
+ }
+
return return_value;
}
@@ -589,23 +604,28 @@ PyDoc_STRVAR(_overlapped_Overlapped_WSASend__doc__,
static PyObject *
_overlapped_Overlapped_WSASend_impl(OverlappedObject *self, HANDLE handle,
- PyObject *bufobj, DWORD flags);
+ Py_buffer *bufobj, DWORD flags);
static PyObject *
_overlapped_Overlapped_WSASend(OverlappedObject *self, PyObject *const *args, Py_ssize_t nargs)
{
PyObject *return_value = NULL;
HANDLE handle;
- PyObject *bufobj;
+ Py_buffer bufobj = {NULL, NULL};
DWORD flags;
- if (!_PyArg_ParseStack(args, nargs, ""F_HANDLE"Ok:WSASend",
+ if (!_PyArg_ParseStack(args, nargs, ""F_HANDLE"y*k:WSASend",
&handle, &bufobj, &flags)) {
goto exit;
}
- return_value = _overlapped_Overlapped_WSASend_impl(self, handle, bufobj, flags);
+ return_value = _overlapped_Overlapped_WSASend_impl(self, handle, &bufobj, flags);
exit:
+ /* Cleanup for bufobj */
+ if (bufobj.obj) {
+ PyBuffer_Release(&bufobj);
+ }
+
return return_value;
}
@@ -852,7 +872,7 @@ PyDoc_STRVAR(_overlapped_Overlapped_WSASendTo__doc__,
static PyObject *
_overlapped_Overlapped_WSASendTo_impl(OverlappedObject *self, HANDLE handle,
- PyObject *bufobj, DWORD flags,
+ Py_buffer *bufobj, DWORD flags,
PyObject *AddressObj);
static PyObject *
@@ -860,17 +880,22 @@ _overlapped_Overlapped_WSASendTo(OverlappedObject *self, PyObject *const *args,
{
PyObject *return_value = NULL;
HANDLE handle;
- PyObject *bufobj;
+ Py_buffer bufobj = {NULL, NULL};
DWORD flags;
PyObject *AddressObj;
- if (!_PyArg_ParseStack(args, nargs, ""F_HANDLE"OkO:WSASendTo",
+ if (!_PyArg_ParseStack(args, nargs, ""F_HANDLE"y*kO:WSASendTo",
&handle, &bufobj, &flags, &AddressObj)) {
goto exit;
}
- return_value = _overlapped_Overlapped_WSASendTo_impl(self, handle, bufobj, flags, AddressObj);
+ return_value = _overlapped_Overlapped_WSASendTo_impl(self, handle, &bufobj, flags, AddressObj);
exit:
+ /* Cleanup for bufobj */
+ if (bufobj.obj) {
+ PyBuffer_Release(&bufobj);
+ }
+
return return_value;
}
@@ -943,4 +968,4 @@ exit:
return return_value;
}
-/*[clinic end generated code: output=5c9b17890ef29d52 input=a9049054013a1b77]*/
+/*[clinic end generated code: output=d19a061ea7398d23 input=a9049054013a1b77]*/