Skip to content
Merged
Prev Previous commit
Next Next commit
Apply suggestions by Hugo
Co-authored-by: Hugo van Kemenade <hugovk@users.noreply.github.com>
  • Loading branch information
JelleZijlstra and hugovk authored Mar 15, 2023
commit 14f9c432c8662d84ca6c15f6f83078576b44bd58
8 changes: 4 additions & 4 deletions Doc/reference/datamodel.rst
Original file line number Diff line number Diff line change
Expand Up @@ -2855,7 +2855,7 @@ Emulating buffer types
----------------------

The :ref:`buffer protocol <bufferobjects>` provides a way for Python
objects to expose efficient access a low-level memory array. This protocol
objects to expose efficient access to a low-level memory array. This protocol
is implemented by builtin types such as :class:`bytes` and :class:`memoryview`,
and third-party libraries may define additional buffer types.

Expand All @@ -2864,16 +2864,16 @@ implement the protocol in Python.

.. method:: object.__buffer__(self, flags)

Called when a buffer is requested from ``self`` (for example, by the
:class:`memoryview` constructor). The ``flags`` argument is an integer
Called when a buffer is requested from *self* (for example, by the
:class:`memoryview` constructor). The *flags* argument is an integer
representing the kind of buffer requested, affecting for example whether
the returned buffer is read-only or writable. :class:`inspect.BufferFlags`
provides a convenient way to interpret the flags. The method must return
a :class:`memoryview` object.

.. method:: object.__release_buffer__(self, buffer)

Called when a buffer is no longer needed. The ``buffer`` argument is a
Called when a buffer is no longer needed. The *buffer* argument is a
:class:`memoryview` object that was previously returned by
:meth:`~object.__buffer__`. The method must release any resources associated
with the buffer. This method should return ``None``.
Expand Down