diff options
author | Berker Peksag <berker.peksag@gmail.com> | 2016-03-02 17:30:18 (GMT) |
---|---|---|
committer | Berker Peksag <berker.peksag@gmail.com> | 2016-03-02 17:30:18 (GMT) |
commit | 6282e656e994a8722f39db6aea99aad2a826dee6 (patch) | |
tree | 7bc4f0399e6f9044787257da18db8f434a2001e2 /Doc | |
parent | d2dc15b26b03c03df664641fce544efa05588945 (diff) | |
download | cpython-6282e656e994a8722f39db6aea99aad2a826dee6.zip cpython-6282e656e994a8722f39db6aea99aad2a826dee6.tar.gz cpython-6282e656e994a8722f39db6aea99aad2a826dee6.tar.bz2 |
Issue #26335: Make mmap.write() return the number of bytes written like
other write methods.
Patch by Jakub Stasiak.
Diffstat (limited to 'Doc')
-rw-r--r-- | Doc/library/mmap.rst | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/Doc/library/mmap.rst b/Doc/library/mmap.rst index 33baf2b..fb24728 100644 --- a/Doc/library/mmap.rst +++ b/Doc/library/mmap.rst @@ -263,13 +263,18 @@ To map anonymous memory, -1 should be passed as the fileno along with the length .. method:: write(bytes) Write the bytes in *bytes* into memory at the current position of the - file pointer; the file position is updated to point after the bytes that - were written. If the mmap was created with :const:`ACCESS_READ`, then + file pointer and return the number of bytes written (never less than + ``len(bytes)``, since if the write fails, a :exc:`ValueError` will be + raised). The file position is updated to point after the bytes that + were written. If the mmap was created with :const:`ACCESS_READ`, then writing to it will raise a :exc:`TypeError` exception. .. versionchanged:: 3.5 Writable :term:`bytes-like object` is now accepted. + .. versionchanged:: 3.6 + The number of bytes written is now returned. + .. method:: write_byte(byte) |