mirror of
https://github.com/python/cpython.git
synced 2025-08-03 08:34:29 +00:00
Issue #26335: Make mmap.write() return the number of bytes written like
other write methods. Patch by Jakub Stasiak.
This commit is contained in:
parent
d2dc15b26b
commit
6282e656e9
4 changed files with 21 additions and 4 deletions
|
@ -389,6 +389,7 @@ mmap_write_method(mmap_object *self,
|
|||
PyObject *args)
|
||||
{
|
||||
Py_buffer data;
|
||||
PyObject *result;
|
||||
|
||||
CHECK_VALID(NULL);
|
||||
if (!PyArg_ParseTuple(args, "y*:write", &data))
|
||||
|
@ -406,9 +407,9 @@ mmap_write_method(mmap_object *self,
|
|||
}
|
||||
memcpy(self->data + self->pos, data.buf, data.len);
|
||||
self->pos = self->pos + data.len;
|
||||
result = PyLong_FromSsize_t(data.len);
|
||||
PyBuffer_Release(&data);
|
||||
Py_INCREF(Py_None);
|
||||
return Py_None;
|
||||
return result;
|
||||
}
|
||||
|
||||
static PyObject *
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue