Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(16810)

Unified Diff: Modules/mmapmodule.c

Issue 26335: Make mmap.write return the number of bytes written like other write methods
Patch Set: Created 3 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Please Sign in to add in-line comments.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « Lib/test/test_mmap.py ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
index bb98a99..50cec24 100644
--- a/Modules/mmapmodule.c
+++ b/Modules/mmapmodule.c
@@ -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 *
« no previous file with comments | « Lib/test/test_mmap.py ('k') | no next file » | no next file with comments »

RSS Feeds Recent Issues | This issue
This is Rietveld 894c83f36cb7+