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-12 14:49:50 +00:00
parent aa8efbf084
commit f91d46a17d
16 changed files with 460 additions and 273 deletions

View file

@ -1328,7 +1328,8 @@ string_buffer_getcharbuf(PyStringObject *self, Py_ssize_t index, const char **pt
static int
string_buffer_getbuffer(PyStringObject *self, Py_buffer *view, int flags)
{
return PyBuffer_FillInfo(view, (void *)self->ob_sval, Py_SIZE(self),
return PyBuffer_FillInfo(view, (PyObject*)self,
(void *)self->ob_sval, Py_SIZE(self),
1, flags);
}
@ -1359,7 +1360,7 @@ static PyBufferProcs string_as_buffer = {
};
#define LEFTSTRIP 0
#define RIGHTSTRIP 1
#define BOTHSTRIP 2
@ -3996,7 +3997,7 @@ PyDoc_STRVAR(p_format__doc__,
\n\
");
static PyMethodDef
string_methods[] = {
/* Counterparts of the obsolete stropmodule functions; except