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*.
........
diff --git a/Python/marshal.c b/Python/marshal.c
index e7e4154..d3f2d7f 100644
--- a/Python/marshal.c
+++ b/Python/marshal.c
@@ -1168,11 +1168,14 @@
marshal_loads(PyObject *self, PyObject *args)
{
RFILE rf;
+ Py_buffer p;
char *s;
Py_ssize_t n;
PyObject* result;
- if (!PyArg_ParseTuple(args, "s#:loads", &s, &n))
+ if (!PyArg_ParseTuple(args, "s*:loads", &p))
return NULL;
+ s = p.buf;
+ n = p.len;
rf.fp = NULL;
rf.ptr = s;
rf.end = s + n;
@@ -1180,6 +1183,7 @@
rf.depth = 0;
result = read_object(&rf);
Py_DECREF(rf.strings);
+ PyBuffer_Release(&p);
return result;
}