diff options
author | R. David Murray <rdmurray@bitdance.com> | 2010-12-11 02:05:32 +0000 |
---|---|---|
committer | R. David Murray <rdmurray@bitdance.com> | 2010-12-11 02:05:32 +0000 |
commit | 07c1bd7457b0a9d65b5cb565dd7cc5dfc5f661db (patch) | |
tree | 0453b6fcc584f3c92e117841a4b4b241576ead08 /Modules/mmapmodule.c | |
parent | 8e63c687eff570ab99a89600a69178b63896d40c (diff) | |
download | cpython-git-07c1bd7457b0a9d65b5cb565dd7cc5dfc5f661db.tar.gz |
Merged revisions 85678 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/branches/py3k
........
r85678 | r.david.murray | 2010-10-17 21:14:06 -0400 (Sun, 17 Oct 2010) | 5 lines
#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.c | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/Modules/mmapmodule.c b/Modules/mmapmodule.c index 00051135d0..79a8a68dde 100644 --- a/Modules/mmapmodule.c +++ b/Modules/mmapmodule.c @@ -125,7 +125,8 @@ mmap_object_dealloc(mmap_object *m_obj) if (m_obj->fd >= 0) (void) close(m_obj->fd); if (m_obj->data!=NULL) { - msync(m_obj->data, m_obj->size, MS_SYNC); + if (m_obj->access != ACCESS_READ && m_obj->access != ACCESS_COPY) + msync(m_obj->data, m_obj->size, MS_SYNC); munmap(m_obj->data, m_obj->size); } #endif /* UNIX */ @@ -570,6 +571,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) |