diff options
Diffstat (limited to 'Objects')
-rw-r--r-- | Objects/abstract.c | 13 | ||||
-rw-r--r-- | Objects/bytearrayobject.c | 2 | ||||
-rw-r--r-- | Objects/bytes_methods.c | 2 | ||||
-rw-r--r-- | Objects/bytesobject.c | 2 | ||||
-rw-r--r-- | Objects/longobject.c | 4 | ||||
-rw-r--r-- | Objects/memoryobject.c | 2 |
6 files changed, 11 insertions, 14 deletions
diff --git a/Objects/abstract.c b/Objects/abstract.c index 177c34a..323c985 100644 --- a/Objects/abstract.c +++ b/Objects/abstract.c @@ -260,8 +260,7 @@ PyObject_AsCharBuffer(PyObject *obj, pb = obj->ob_type->tp_as_buffer; if (pb == NULL || pb->bf_getbuffer == NULL) { PyErr_SetString(PyExc_TypeError, - "expected bytes, bytearray " - "or buffer compatible object"); + "expected a bytes-like object"); return -1; } if ((*pb->bf_getbuffer)(obj, &view, PyBUF_SIMPLE)) return -1; @@ -306,7 +305,7 @@ int PyObject_AsReadBuffer(PyObject *obj, if (pb == NULL || pb->bf_getbuffer == NULL) { PyErr_SetString(PyExc_TypeError, - "expected an object with a buffer interface"); + "expected a bytes-like object"); return -1; } @@ -336,7 +335,7 @@ int PyObject_AsWriteBuffer(PyObject *obj, pb->bf_getbuffer == NULL || ((*pb->bf_getbuffer)(obj, &view, PyBUF_WRITABLE) != 0)) { PyErr_SetString(PyExc_TypeError, - "expected an object with a writable buffer interface"); + "expected a writable bytes-like object"); return -1; } @@ -355,7 +354,7 @@ PyObject_GetBuffer(PyObject *obj, Py_buffer *view, int flags) { if (!PyObject_CheckBuffer(obj)) { PyErr_Format(PyExc_TypeError, - "'%.100s' does not support the buffer interface", + "a bytes-like object is required, not '%.100s'", Py_TYPE(obj)->tp_name); return -1; } @@ -530,8 +529,8 @@ int PyObject_CopyData(PyObject *dest, PyObject *src) if (!PyObject_CheckBuffer(dest) || !PyObject_CheckBuffer(src)) { PyErr_SetString(PyExc_TypeError, - "both destination and source must have the "\ - "buffer interface"); + "both destination and source must be "\ + "bytes-like objects"); return -1; } diff --git a/Objects/bytearrayobject.c b/Objects/bytearrayobject.c index f6f370d..84447bc 100644 --- a/Objects/bytearrayobject.c +++ b/Objects/bytearrayobject.c @@ -87,7 +87,7 @@ _getbuffer(PyObject *obj, Py_buffer *view) if (buffer == NULL || buffer->bf_getbuffer == NULL) { PyErr_Format(PyExc_TypeError, - "Type %.100s doesn't support the buffer API", + "a bytes-like object is required, not '%.100s'", Py_TYPE(obj)->tp_name); return -1; } diff --git a/Objects/bytes_methods.c b/Objects/bytes_methods.c index 5314ab4..1cf20c9 100644 --- a/Objects/bytes_methods.c +++ b/Objects/bytes_methods.c @@ -371,7 +371,7 @@ _getbuffer(PyObject *obj, Py_buffer *view) if (buffer == NULL || buffer->bf_getbuffer == NULL) { PyErr_Format(PyExc_TypeError, - "Type %.100s doesn't support the buffer API", + "a bytes-like object is required, not '%.100s'", Py_TYPE(obj)->tp_name); return -1; } diff --git a/Objects/bytesobject.c b/Objects/bytesobject.c index 87c0a25..ff99f93 100644 --- a/Objects/bytesobject.c +++ b/Objects/bytesobject.c @@ -29,7 +29,7 @@ _getbuffer(PyObject *obj, Py_buffer *view) if (bufferprocs == NULL || bufferprocs->bf_getbuffer == NULL) { PyErr_Format(PyExc_TypeError, - "Type %.100s doesn't support the buffer API", + "a bytes-like object is required, not '%.100s'", Py_TYPE(obj)->tp_name); return -1; } diff --git a/Objects/longobject.c b/Objects/longobject.c index bb2eb17..27bee50 100644 --- a/Objects/longobject.c +++ b/Objects/longobject.c @@ -4873,9 +4873,7 @@ PyDoc_STRVAR(long_from_bytes_doc, \n\ Return the integer represented by the given array of bytes.\n\ \n\ -The bytes argument must either support the buffer protocol or be an\n\ -iterable object producing bytes. Bytes and bytearray are examples of\n\ -built-in objects that support the buffer protocol.\n\ +The bytes argument must be a bytes-like object (e.g. bytes or bytearray).\n\ \n\ The byteorder argument determines the byte order used to represent the\n\ integer. If byteorder is 'big', the most significant byte is at the\n\ diff --git a/Objects/memoryobject.c b/Objects/memoryobject.c index 5148ce6..935da04 100644 --- a/Objects/memoryobject.c +++ b/Objects/memoryobject.c @@ -792,7 +792,7 @@ PyMemoryView_FromObject(PyObject *v) } PyErr_Format(PyExc_TypeError, - "memoryview: %.200s object does not have the buffer interface", + "memoryview: a bytes-like object is required, not '%.200s'", Py_TYPE(v)->tp_name); return NULL; } |