Merged revisions 65654 via svnmerge from

svn+ssh://pythondev@svn.python.org/python/trunk

........
  r65654 | martin.v.loewis | 2008-08-12 16:49:50 +0200 (Tue, 12 Aug 2008) | 6 lines

  Issue #3139: Make buffer-interface thread-safe wrt. PyArg_ParseTuple,
  by denying s# to parse objects that have a releasebuffer procedure,
  and introducing s*.

  More module might need to get converted to use s*.
........
This commit is contained in:
Martin v. Löwis 2008-08-13 15:53:07 +00:00
parent 688356f59f
commit 423be95dcf
32 changed files with 721 additions and 390 deletions

View file

@ -651,7 +651,7 @@ static int
mmap_buffer_getbuf(mmap_object *self, Py_buffer *view, int flags)
{
CHECK_VALID(-1);
if (PyBuffer_FillInfo(view, self->data, self->size,
if (PyBuffer_FillInfo(view, (PyObject*)self, self->data, self->size,
(self->access == ACCESS_READ), flags) < 0)
return -1;
self->exports++;
@ -843,7 +843,7 @@ mmap_ass_subscript(mmap_object *self, PyObject *item, PyObject *value)
if (vbuf.len != slicelen) {
PyErr_SetString(PyExc_IndexError,
"mmap slice assignment is wrong size");
PyObject_ReleaseBuffer(value, &vbuf);
PyBuffer_Release(&vbuf);
return -1;
}
@ -862,7 +862,7 @@ mmap_ass_subscript(mmap_object *self, PyObject *item, PyObject *value)
self->data[cur] = ((char *)vbuf.buf)[i];
}
}
PyObject_ReleaseBuffer(value, &vbuf);
PyBuffer_Release(&vbuf);
return 0;
}
else {