summaryrefslogtreecommitdiff
path: root/Python/getargs.c
diff options
context:
space:
mode:
Diffstat (limited to 'Python/getargs.c')
-rw-r--r--Python/getargs.c10
1 files changed, 7 insertions, 3 deletions
diff --git a/Python/getargs.c b/Python/getargs.c
index cf4444c36e..b7beb37c90 100644
--- a/Python/getargs.c
+++ b/Python/getargs.c
@@ -1354,7 +1354,7 @@ convertbuffer(PyObject *arg, void **p, char **errmsg)
/* XXX for 3.x, getbuffer and convertbuffer can probably
be merged again. */
static int
-getbuffer(PyObject *arg, Py_buffer *view, char**errmsg)
+getbuffer(PyObject *arg, Py_buffer *view, char **errmsg)
{
void *buf;
Py_ssize_t count;
@@ -1364,8 +1364,10 @@ getbuffer(PyObject *arg, Py_buffer *view, char**errmsg)
return -1;
}
if (pb->bf_getbuffer) {
- if (pb->bf_getbuffer(arg, view, 0) < 0)
+ if (pb->bf_getbuffer(arg, view, 0) < 0) {
+ *errmsg = "convertible to a buffer";
return -1;
+ }
if (!PyBuffer_IsContiguous(view, 'C')) {
*errmsg = "contiguous buffer";
return -1;
@@ -1374,8 +1376,10 @@ getbuffer(PyObject *arg, Py_buffer *view, char**errmsg)
}
count = convertbuffer(arg, &buf, errmsg);
- if (count < 0)
+ if (count < 0) {
+ *errmsg = "convertible to a buffer";
return count;
+ }
PyBuffer_FillInfo(view, NULL, buf, count, 1, 0);
return 0;
}