summaryrefslogtreecommitdiffstats
path: root/Modules/posixmodule.c
diff options
context:
space:
mode:
Diffstat (limited to 'Modules/posixmodule.c')
-rw-r--r--Modules/posixmodule.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/Modules/posixmodule.c b/Modules/posixmodule.c
index 3b79d05..b499b47 100644
--- a/Modules/posixmodule.c
+++ b/Modules/posixmodule.c
@@ -4894,15 +4894,16 @@ Write a string to a file descriptor.");
static PyObject *
posix_write(PyObject *self, PyObject *args)
{
+ Py_buffer pbuf;
int fd;
Py_ssize_t size;
- char *buffer;
- if (!PyArg_ParseTuple(args, "is#:write", &fd, &buffer, &size))
+ if (!PyArg_ParseTuple(args, "is*:write", &fd, &pbuf))
return NULL;
Py_BEGIN_ALLOW_THREADS
- size = write(fd, buffer, (size_t)size);
+ size = write(fd, pbuf.buf, (size_t)pbuf.len);
Py_END_ALLOW_THREADS
+ PyBuffer_Release(&pbuf);
if (size < 0)
return posix_error();
return PyLong_FromSsize_t(size);