#16518: use "bytes-like object" throughout the docs.

This commit is contained in:
Ezio Melotti 2013-05-04 18:06:34 +03:00
parent 28faf03d44
commit c228e96726
8 changed files with 24 additions and 28 deletions

View file

@ -70,8 +70,7 @@ Unless otherwise stated, buffers are not NUL-terminated.
as *converter*.
``s*`` (:class:`str`, :class:`bytes`, :class:`bytearray` or buffer compatible object) [Py_buffer]
This format accepts Unicode objects as well as objects supporting the
buffer protocol.
This format accepts Unicode objects as well as :term:`bytes-like object`\ s.
It fills a :c:type:`Py_buffer` structure provided by the caller.
In this case the resulting C string may contain embedded NUL bytes.
Unicode objects are converted to C strings using ``'utf-8'`` encoding.
@ -101,14 +100,14 @@ Unless otherwise stated, buffers are not NUL-terminated.
contain embedded NUL bytes; if it does, a :exc:`TypeError`
exception is raised.
``y*`` (:class:`bytes`, :class:`bytearray` or buffer compatible object) [Py_buffer]
This variant on ``s*`` doesn't accept Unicode objects, only objects
supporting the buffer protocol. **This is the recommended way to accept
``y*`` (:class:`bytes`, :class:`bytearray` or :term:`bytes-like object`) [Py_buffer]
This variant on ``s*`` doesn't accept Unicode objects, only
:term:`bytes-like object`\ s. **This is the recommended way to accept
binary data.**
``y#`` (:class:`bytes`) [const char \*, int]
This variant on ``s#`` doesn't accept Unicode objects, only bytes-like
objects.
This variant on ``s#`` doesn't accept Unicode objects, only :term:`bytes-like
object`\ s.
``S`` (:class:`bytes`) [PyBytesObject \*]
Requires that the Python object is a :class:`bytes` object, without

View file

@ -40,7 +40,7 @@ Direct API functions
.. c:function:: PyObject* PyByteArray_FromObject(PyObject *o)
Return a new bytearray object from any object, *o*, that implements the
buffer protocol.
:ref:`buffer protocol <bufferobjects>`.
.. XXX expand about the buffer protocol, at least somewhere