Kaydet (Commit) 2a4b3fce authored tarafından R. David Murray's avatar R. David Murray

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.
........
üst 5f76602f
...@@ -29,6 +29,11 @@ Library ...@@ -29,6 +29,11 @@ Library
- Issue #10464: netrc now correctly handles lines with embedded '#' characters. - Issue #10464: netrc now correctly handles lines with embedded '#' characters.
Extension Modules
-----------------
- Issue #678250: Make mmap flush a noop on ACCESS_READ and ACCESS_COPY.
Tests Tests
----- -----
......
...@@ -124,7 +124,8 @@ mmap_object_dealloc(mmap_object *m_obj) ...@@ -124,7 +124,8 @@ mmap_object_dealloc(mmap_object *m_obj)
if (m_obj->fd >= 0) if (m_obj->fd >= 0)
(void) close(m_obj->fd); (void) close(m_obj->fd);
if (m_obj->data!=NULL) { 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); munmap(m_obj->data, m_obj->size);
} }
#endif /* UNIX */ #endif /* UNIX */
...@@ -559,6 +560,10 @@ mmap_flush_method(mmap_object *self, PyObject *args) ...@@ -559,6 +560,10 @@ mmap_flush_method(mmap_object *self, PyObject *args)
PyErr_SetString(PyExc_ValueError, "flush values out of range"); PyErr_SetString(PyExc_ValueError, "flush values out of range");
return NULL; return NULL;
} }
if (self->access == ACCESS_READ || self->access == ACCESS_COPY)
return PyLong_FromLong(0);
#ifdef MS_WINDOWS #ifdef MS_WINDOWS
return PyInt_FromLong((long) FlushViewOfFile(self->data+offset, size)); return PyInt_FromLong((long) FlushViewOfFile(self->data+offset, size));
#elif defined(UNIX) #elif defined(UNIX)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment