[Python-checkins] cpython (3.2): Issue #12102: Document that buffered files must be flushed before being used

ross.lagerwall python-checkins at python.org
Mon Jul 25 07:15:52 CEST 2011


http://hg.python.org/cpython/rev/198627bbe242
changeset:   71496:198627bbe242
branch:      3.2
parent:      71494:1fdad36ac838
user:        Ross Lagerwall <rosslagerwall at gmail.com>
date:        Mon Jul 25 07:12:43 2011 +0200
summary:
  Issue #12102: Document that buffered files must be flushed before being used
with mmap. Patch by Steffen Daode Nurpmeso.

files:
  Doc/ACKS.txt         |  1 +
  Doc/library/mmap.rst |  6 ++++++
  Misc/NEWS            |  3 +++
  3 files changed, 10 insertions(+), 0 deletions(-)


diff --git a/Doc/ACKS.txt b/Doc/ACKS.txt
--- a/Doc/ACKS.txt
+++ b/Doc/ACKS.txt
@@ -144,6 +144,7 @@
    * Sjoerd Mullender
    * Dale Nagata
    * Michal Nowikowski
+   * Steffen Daode Nurpmeso
    * Ng Pheng Siong
    * Koray Oner
    * Tomas Oppelstrup
diff --git a/Doc/library/mmap.rst b/Doc/library/mmap.rst
--- a/Doc/library/mmap.rst
+++ b/Doc/library/mmap.rst
@@ -21,6 +21,12 @@
 :func:`os.open` function, which returns a file descriptor directly (the file
 still needs to be closed when done).
 
+.. note::
+   If you want to create a memory-mapping for a writable, buffered file, you
+   should :func:`~io.IOBase.flush` the file first.  This is necessary to ensure
+   that local modifications to the buffers are actually available to the
+   mapping.
+
 For both the Unix and Windows versions of the constructor, *access* may be
 specified as an optional keyword parameter. *access* accepts one of three
 values: :const:`ACCESS_READ`, :const:`ACCESS_WRITE`, or :const:`ACCESS_COPY`
diff --git a/Misc/NEWS b/Misc/NEWS
--- a/Misc/NEWS
+++ b/Misc/NEWS
@@ -37,6 +37,9 @@
 Library
 -------
 
+- Issue #12102: Document that buffered files must be flushed before being used
+  with mmap. Patch by Steffen Daode Nurpmeso.
+
 - Issue #12560: Build libpython.so on OpenBSD. Patch by Stefan Sperling.
 
 - Issue #1813: Fix codec lookup under Turkish locales.

-- 
Repository URL: http://hg.python.org/cpython


More information about the Python-checkins mailing list