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

Unified Diff: Doc/library/mmap.rst

Issue 26335: Make mmap.write return the number of bytes written like other write methods
Patch Set: Created 3 years, 6 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 | « no previous file | Lib/test/test_mmap.py » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
index b74a823..2449da0 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
+ 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 (previously: *None*).
+
.. method:: write_byte(byte)
« no previous file with comments | « no previous file | Lib/test/test_mmap.py » ('j') | no next file with comments »

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