diff options
Diffstat (limited to 'Doc/c-api/arg.rst')
-rw-r--r-- | Doc/c-api/arg.rst | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/Doc/c-api/arg.rst b/Doc/c-api/arg.rst index 8427bc4..983d113 100644 --- a/Doc/c-api/arg.rst +++ b/Doc/c-api/arg.rst @@ -30,7 +30,7 @@ variable(s) whose address should be passed. Strings and buffers ------------------- -These formats allow to access an object as a contiguous chunk of memory. +These formats allow accessing an object as a contiguous chunk of memory. You don't have to provide raw storage for the returned unicode or bytes area. Also, you won't have to release any memory yourself, except with the ``es``, ``es#``, ``et`` and ``et#`` formats. @@ -152,7 +152,7 @@ Unless otherwise stated, buffers are not NUL-terminated. any conversion. Raises :exc:`TypeError` if the object is not a Unicode object. The C variable may also be declared as :c:type:`PyObject\*`. -``w*`` (:class:`bytearray` or read-write byte-oriented buffer) [Py_buffer] +``w*`` (read-write :term:`bytes-like object`) [Py_buffer] This format accepts any object which implements the read-write buffer interface. It fills a :c:type:`Py_buffer` structure provided by the caller. The buffer may contain embedded null bytes. The caller have to call @@ -206,7 +206,8 @@ Unless otherwise stated, buffers are not NUL-terminated. :c:func:`PyArg_ParseTuple` will use this location as the buffer and interpret the initial value of *\*buffer_length* as the buffer size. It will then copy the encoded data into the buffer and NUL-terminate it. If the buffer is not large - enough, a :exc:`ValueError` will be set. + enough, a :exc:`TypeError` will be set. + Note: starting from Python 3.6 a :exc:`ValueError` will be set. In both cases, *\*buffer_length* is set to the length of the encoded data without the trailing NUL byte. |