summaryrefslogtreecommitdiffstats
path: root/Python/getargs.c
diff options
context:
space:
mode:
authorR David Murray <rdmurray@bitdance.com>2014-10-05 15:47:01 (GMT)
committerR David Murray <rdmurray@bitdance.com>2014-10-05 15:47:01 (GMT)
commit861470c83607a4312d3c65bce3e18414b965e586 (patch)
tree48088d67e50d8599b00498c17b5c8b7a35b482f8 /Python/getargs.c
parentd577cea8ab0d929c40de93947dd68b9709607b35 (diff)
downloadcpython-861470c83607a4312d3c65bce3e18414b965e586.zip
cpython-861470c83607a4312d3c65bce3e18414b965e586.tar.gz
cpython-861470c83607a4312d3c65bce3e18414b965e586.tar.bz2
#16518: Bring error messages in harmony with docs ("bytes-like object")
Some time ago we changed the docs to consistently use the term 'bytes-like object' in all the contexts where bytes, bytearray, memoryview, etc are used. This patch (by Ezio Melotti) completes that work by changing the error messages that previously reported that certain types did "not support the buffer interface" to instead say that a bytes-like object is required. (The glossary entry for bytes-like object references the discussion of the buffer protocol in the docs.)
Diffstat (limited to 'Python/getargs.c')
-rw-r--r--Python/getargs.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/Python/getargs.c b/Python/getargs.c
index c749bb6..f7297da 100644
--- a/Python/getargs.c
+++ b/Python/getargs.c
@@ -1244,7 +1244,8 @@ convertsimple(PyObject *arg, const char **p_format, va_list *p_va, int flags,
supports it directly. */
if (PyObject_GetBuffer(arg, (Py_buffer*)p, PyBUF_WRITABLE) < 0) {
PyErr_Clear();
- return converterr("read-write buffer", arg, msgbuf, bufsize);
+ return converterr("read-write bytes-like object",
+ arg, msgbuf, bufsize);
}
if (!PyBuffer_IsContiguous((Py_buffer*)p, 'C')) {
PyBuffer_Release((Py_buffer*)p);
@@ -1282,7 +1283,7 @@ convertbuffer(PyObject *arg, void **p, char **errmsg)
*errmsg = NULL;
*p = NULL;
if (pb != NULL && pb->bf_releasebuffer != NULL) {
- *errmsg = "read-only pinned buffer";
+ *errmsg = "read-only bytes-like object";
return -1;
}
@@ -1298,7 +1299,7 @@ static int
getbuffer(PyObject *arg, Py_buffer *view, char **errmsg)
{
if (PyObject_GetBuffer(arg, view, PyBUF_SIMPLE) != 0) {
- *errmsg = "bytes or buffer";
+ *errmsg = "bytes-like object";
return -1;
}
if (!PyBuffer_IsContiguous(view, 'C')) {