From a56f2aeed0ef5e2aa8c4548598242bfce45a6cb6 Mon Sep 17 00:00:00 2001 From: Zackery Spytz Date: Sun, 19 Apr 2020 15:16:07 -0600 Subject: [PATCH 1/2] bpo-23980: Improve the docs for format units starting with 'e' --- Doc/c-api/arg.rst | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/Doc/c-api/arg.rst b/Doc/c-api/arg.rst index b7baad589a72c8..d4ebdc205e4775 100644 --- a/Doc/c-api/arg.rst +++ b/Doc/c-api/arg.rst @@ -191,7 +191,7 @@ which disallows mutable objects such as :class:`bytearray`. The buffer may contain embedded null bytes. The caller have to call :c:func:`PyBuffer_Release` when it is done with the buffer. -``es`` (:class:`str`) [const char \*encoding, char \*\*buffer] +``es`` (:class:`str`) [*encoding*, char \*buffer] This variant on ``s`` is used for encoding Unicode into a character buffer. It only works for encoded data without embedded NUL bytes. @@ -208,12 +208,12 @@ which disallows mutable objects such as :class:`bytearray`. allocated storage. The caller is responsible for calling :c:func:`PyMem_Free` to free the allocated buffer after use. -``et`` (:class:`str`, :class:`bytes` or :class:`bytearray`) [const char \*encoding, char \*\*buffer] +``et`` (:class:`str`, :class:`bytes` or :class:`bytearray`) [*encoding*, char \*buffer] Same as ``es`` except that byte string objects are passed through without recoding them. Instead, the implementation assumes that the byte string object uses the encoding passed in as parameter. -``es#`` (:class:`str`) [const char \*encoding, char \*\*buffer, int or :c:type:`Py_ssize_t` \*buffer_length] +``es#`` (:class:`str`) [*encoding*, char \*buffer, int or :c:type:`Py_ssize_t` buffer_length] This variant on ``s#`` is used for encoding Unicode into a character buffer. Unlike the ``es`` format, this variant allows input data which contains NUL characters. @@ -244,7 +244,7 @@ which disallows mutable objects such as :class:`bytearray`. In both cases, *\*buffer_length* is set to the length of the encoded data without the trailing NUL byte. -``et#`` (:class:`str`, :class:`bytes` or :class:`bytearray`) [const char \*encoding, char \*\*buffer, int or :c:type:`Py_ssize_t` \*buffer_length] +``et#`` (:class:`str`, :class:`bytes` or :class:`bytearray`) [*encoding*, char \*buffer, int or :c:type:`Py_ssize_t` buffer_length] Same as ``es#`` except that byte string objects are passed through without recoding them. Instead, the implementation assumes that the byte string object uses the encoding passed in as parameter. From 107ede94b97a9583affb551915150fbfc7cad55c Mon Sep 17 00:00:00 2001 From: "Erlend E. Aasland" Date: Fri, 5 Jan 2024 13:42:34 +0100 Subject: [PATCH 2/2] Fix merge --- Doc/c-api/arg.rst | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Doc/c-api/arg.rst b/Doc/c-api/arg.rst index 010463c3876b4a..6ae10f185182fb 100644 --- a/Doc/c-api/arg.rst +++ b/Doc/c-api/arg.rst @@ -185,7 +185,7 @@ There are three ways strings and buffers can be converted to C: recoding them. Instead, the implementation assumes that the byte string object uses the encoding passed in as parameter. -``es#`` (:class:`str`) [*encoding*, char \*\*buffer, :c:type:`Py_ssize_t` \*buffer_length] +``es#`` (:class:`str`) [*encoding*, char \*buffer, :c:type:`Py_ssize_t` buffer_length] This variant on ``s#`` is used for encoding Unicode into a character buffer. Unlike the ``es`` format, this variant allows input data which contains NUL characters. @@ -216,7 +216,7 @@ There are three ways strings and buffers can be converted to C: In both cases, *\*buffer_length* is set to the length of the encoded data without the trailing NUL byte. -``et#`` (:class:`str`, :class:`bytes` or :class:`bytearray`) [*encoding*, char \*\*buffer, :c:type:`Py_ssize_t` \*buffer_length] +``et#`` (:class:`str`, :class:`bytes` or :class:`bytearray`) [*encoding*, char \*buffer, :c:type:`Py_ssize_t` buffer_length] Same as ``es#`` except that byte string objects are passed through without recoding them. Instead, the implementation assumes that the byte string object uses the encoding passed in as parameter.