Skip to content

gh-53243: Document codecs.readbuffer_encode() #136284

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 15 additions & 0 deletions Doc/library/codecs.rst
Original file line number Diff line number Diff line change
Expand Up @@ -265,6 +265,21 @@ wider range of codecs when working with binary files:
:func:`iterencode`.


.. function:: readbuffer_encode(buffer, errors=None, /)

Return a :class:`tuple` containing the raw bytes of *buffer*, a
:ref:`buffer-compatible object <bufferobjects>` or :class:`str`, and their
length.

The *errors* argument is ignored and exists only for compatibility with
other functions.

.. code-block:: pycon

>>> codecs.readbuffer_encode(b"Zito")
(b'Zito', 4)


The module also provides the following constants which are useful for reading
and writing to platform dependent files:

Expand Down
Loading