]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
#678250: Make mmap flush a noop on ACCESS_READ and ACCESS_COPY.
authorR. David Murray <rdmurray@bitdance.com>
Mon, 18 Oct 2010 01:14:06 +0000 (01:14 +0000)
committerR. David Murray <rdmurray@bitdance.com>
Mon, 18 Oct 2010 01:14:06 +0000 (01:14 +0000)
Patch by SĂ©bastien SablĂ©.  This solves a test_mmap failure on AIX.

Misc/NEWS
Modules/mmapmodule.c

index 188947833ef40f3329ad85e86263550717abe4c8..15c0bb346a6d42134326a6ce75604b812bc003b9 100644 (file)
--- a/Misc/NEWS
+++ b/Misc/NEWS
@@ -87,6 +87,8 @@ Library
 Extensions
 ----------
 
+- Issue #678250: Make mmap flush a noop on ACCESS_READ and ACCESS_COPY.
+
 - Issue #9054: Fix a crash occurring when using the pyexpat module
   with expat version 2.0.1.
 
index 3413f17ebd3cdb766e10532197e7bee1bd5f55c5..680f1f1102a95ca9feecfd422957581d5aff40fd 100644 (file)
@@ -569,6 +569,10 @@ mmap_flush_method(mmap_object *self, PyObject *args)
         PyErr_SetString(PyExc_ValueError, "flush values out of range");
         return NULL;
     }
+
+    if (self->access == ACCESS_READ || self->access == ACCESS_COPY)
+        return PyLong_FromLong(0);
+
 #ifdef MS_WINDOWS
     return PyLong_FromLong((long) FlushViewOfFile(self->data+offset, size));
 #elif defined(UNIX)