@@ -26,17 +26,19 @@ characteristic of being backed by a possibly large memory buffer. It is
2626then desirable, in some situations, to access that buffer directly and
2727without intermediate copying.
2828
29- Python provides such a facility at the C level in the form of the :ref: ` buffer
30- protocol <bufferobjects>`. This protocol has two sides:
29+ Python provides such a facility at the C and Python level in the form of the
30+ :ref: ` buffer protocol <bufferobjects >`. This protocol has two sides:
3131
3232.. index :: single: PyBufferProcs (C type)
3333
3434- on the producer side, a type can export a "buffer interface" which allows
3535 objects of that type to expose information about their underlying buffer.
36- This interface is described in the section :ref: `buffer-structs `;
36+ This interface is described in the section :ref: `buffer-structs `; for
37+ Python see :ref: `python-buffer-protocol `.
3738
3839- on the consumer side, several means are available to obtain a pointer to
39- the raw underlying data of an object (for example a method parameter).
40+ the raw underlying data of an object (for example a method parameter). For
41+ Python see :class: `memoryview `.
4042
4143Simple objects such as :class: `bytes ` and :class: `bytearray ` expose their
4244underlying buffer in byte-oriented form. Other forms are possible; for example,
@@ -62,6 +64,10 @@ In both cases, :c:func:`PyBuffer_Release` must be called when the buffer
6264isn't needed anymore. Failure to do so could lead to various issues such as
6365resource leaks.
6466
67+ .. versionadded :: 3.12
68+
69+ The buffer protocol is now accessible in Python, see
70+ :ref: `python-buffer-protocol ` and :class: `memoryview `.
6571
6672.. _buffer-structure :
6773
0 commit comments