summaryrefslogtreecommitdiffstats
path: root/Modules/mmapmodule.c
diff options
context:
space:
mode:
authorR. David Murray <rdmurray@bitdance.com>2010-10-18 01:14:06 (GMT)
committerR. David Murray <rdmurray@bitdance.com>2010-10-18 01:14:06 (GMT)
commite194dd60f0d00a3537ca118cfe5372c72c33bdf3 (patch)
treef94407312ce1f77f346193d060cb70290eb505c7 /Modules/mmapmodule.c
parent051176fde88331b182af3706672dc90874c5347b (diff)
downloadcpython-e194dd60f0d00a3537ca118cfe5372c72c33bdf3.zip
cpython-e194dd60f0d00a3537ca118cfe5372c72c33bdf3.tar.gz
cpython-e194dd60f0d00a3537ca118cfe5372c72c33bdf3.tar.bz2
#678250: Make mmap flush a noop on ACCESS_READ and ACCESS_COPY.
Patch by Sébastien Sablé. This solves a test_mmap failure on AIX.
Diffstat (limited to 'Modules/mmapmodule.c')
-rw-r--r--Modules/mmapmodule.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/Modules/mmapmodule.c b/Modules/mmapmodule.c
index 3413f17..680f1f1 100644
--- a/Modules/mmapmodule.c
+++ b/Modules/mmapmodule.c
@@ -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)