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

Side by Side 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, 3 months ago
Left:
Right:
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 unified diff | Download patch
« no previous file with comments | « no previous file | Lib/test/test_mmap.py » ('j') | Lib/test/test_mmap.py » ('J')
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 :mod:`mmap` --- Memory-mapped file support 1 :mod:`mmap` --- Memory-mapped file support
2 ========================================== 2 ==========================================
3 3
4 .. module:: mmap 4 .. module:: mmap
5 :synopsis: Interface to memory-mapped files for Unix and Windows. 5 :synopsis: Interface to memory-mapped files for Unix and Windows.
6 6
7 7
8 Memory-mapped file objects behave like both :class:`bytearray` and like 8 Memory-mapped file objects behave like both :class:`bytearray` and like
9 :term:`file objects <file object>`. You can use mmap objects in most places 9 :term:`file objects <file object>`. You can use mmap objects in most places
10 where :class:`bytearray` are expected; for example, you can use the :mod:`re` 10 where :class:`bytearray` are expected; for example, you can use the :mod:`re`
(...skipping 245 matching lines...) Expand 10 before | Expand all | Expand 10 after
256 256
257 257
258 .. method:: tell() 258 .. method:: tell()
259 259
260 Returns the current position of the file pointer. 260 Returns the current position of the file pointer.
261 261
262 262
263 .. method:: write(bytes) 263 .. method:: write(bytes)
264 264
265 Write the bytes in *bytes* into memory at the current position of the 265 Write the bytes in *bytes* into memory at the current position of the
266 file pointer; the file position is updated to point after the bytes that 266 file pointer and return the number of bytes written (never less than
berkerpeksag 2016/02/23 00:57:52 We also need a versionchanged directive to explain
267 len(bytes), since if the write fails a :exc:`ValueError` will be
268 raised). The file position is updated to point after the bytes that
267 were written. If the mmap was created with :const:`ACCESS_READ`, then 269 were written. If the mmap was created with :const:`ACCESS_READ`, then
268 writing to it will raise a :exc:`TypeError` exception. 270 writing to it will raise a :exc:`TypeError` exception.
269 271
270 .. versionchanged: 3.5 272 .. versionchanged: 3.5
271 Writable :term:`bytes-like object` is now accepted. 273 Writable :term:`bytes-like object` is now accepted.
272 274
273 275
274 .. method:: write_byte(byte) 276 .. method:: write_byte(byte)
275 277
276 Write the integer *byte* into memory at the current 278 Write the integer *byte* into memory at the current
277 position of the file pointer; the file position is advanced by ``1``. If 279 position of the file pointer; the file position is advanced by ``1``. If
278 the mmap was created with :const:`ACCESS_READ`, then writing to it will 280 the mmap was created with :const:`ACCESS_READ`, then writing to it will
279 raise a :exc:`TypeError` exception. 281 raise a :exc:`TypeError` exception.
OLDNEW
« no previous file with comments | « no previous file | Lib/test/test_mmap.py » ('j') | Lib/test/test_mmap.py » ('J')

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