This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author schmir
Recipients schmir
Date 2008-02-15.13:20:01
SpamBayes Score 0.0343559
Marked as misclassified No
Message-id <>
mmap.flush returns the result of the call to FlushViewOfFile as an
integer, and does not check for errors. On unix it does check for
errors. The function should return None and raise an exception if an
error occurs...
This bug can lead to data loss...

Here's the current version of that function:

static PyObject *
mmap_flush_method(mmap_object *self, PyObject *args)
	Py_ssize_t offset = 0;
	Py_ssize_t size = self->size;
	if (!PyArg_ParseTuple(args, "|nn:flush", &offset, &size))
		return NULL;
	if ((size_t)(offset + size) > self->size) {
		PyErr_SetString(PyExc_ValueError, "flush values out of range");
		return NULL;
	return PyInt_FromLong((long) FlushViewOfFile(self->data+offset, size));
#elif defined(UNIX)
	/* XXX semantics of return value? */
	/* XXX flags for msync? */
	if (-1 == msync(self->data + offset, size, MS_SYNC)) {
		return NULL;
	return PyInt_FromLong(0);
	PyErr_SetString(PyExc_ValueError, "flush not supported on this system");
	return NULL;
Date User Action Args
2008-02-15 13:20:04schmirsetspambayes_score: 0.0343559 -> 0.0343559
recipients: + schmir
2008-02-15 13:20:03schmirsetspambayes_score: 0.0343559 -> 0.0343559
messageid: <>
2008-02-15 13:20:02schmirlinkissue2122 messages
2008-02-15 13:20:01schmircreate