Skip to content

Commit faee362

Browse files
[3.13] gh-53243: Document codecs.readbuffer_encode() (GH-136284) (#136451)
gh-53243: Document `codecs.readbuffer_encode()` (GH-136284) Closes GH-53243 (cherry picked from commit f1dcf3c) Co-authored-by: Stan Ulbrych <[email protected]>
1 parent 301c89c commit faee362

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

Doc/library/codecs.rst

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -261,6 +261,20 @@ wider range of codecs when working with binary files:
261261
:func:`iterencode`.
262262

263263

264+
.. function:: readbuffer_encode(buffer, errors=None, /)
265+
266+
Return a :class:`tuple` containing the raw bytes of *buffer*, a
267+
:ref:`buffer-compatible object <bufferobjects>` or :class:`str`
268+
(encoded to UTF-8 before processing), and their length in bytes.
269+
270+
The *errors* argument is ignored.
271+
272+
.. code-block:: pycon
273+
274+
>>> codecs.readbuffer_encode(b"Zito")
275+
(b'Zito', 4)
276+
277+
264278
The module also provides the following constants which are useful for reading
265279
and writing to platform dependent files:
266280

0 commit comments

Comments
 (0)