From 59c01edcaa4a973e159d2ed3a5084936d3fffa18 Mon Sep 17 00:00:00 2001 From: Ross Lagerwall Date: Mon, 25 Jul 2011 07:12:43 +0200 Subject: [PATCH] Issue #12102: Document that buffered files must be flushed before being used with mmap. Patch by Steffen Daode Nurpmeso. --- Doc/ACKS.txt | 1 + Doc/library/mmap.rst | 6 ++++++ Misc/NEWS | 3 +++ 3 files changed, 10 insertions(+) diff --git a/Doc/ACKS.txt b/Doc/ACKS.txt index 1ad18f15b3e..c5282478c6a 100644 --- a/Doc/ACKS.txt +++ b/Doc/ACKS.txt @@ -144,6 +144,7 @@ docs@python.org), and we'll be glad to correct the problem. * 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 index 7a901c93f7e..6a74a14351d 100644 --- a/Doc/library/mmap.rst +++ b/Doc/library/mmap.rst @@ -21,6 +21,12 @@ file object, use its :meth:`fileno` method to obtain the correct value for the :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 index 3fcdc9600c6..662eedc8d8a 100644 --- a/Misc/NEWS +++ b/Misc/NEWS @@ -37,6 +37,9 @@ Core and Builtins 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.