Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit a0b6873

Browse files
committed
Discourage use of the old buffer API funcs
1 parent 3e1fd27 commit a0b6873

1 file changed

Lines changed: 16 additions & 1 deletion

File tree

Doc/c-api/objbuffer.rst

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,21 @@
11
.. highlightlang:: c
22

3-
.. _abstract-buffer:
3+
Old buffer API
4+
--------------
5+
6+
.. deprecated:: 3.0
7+
8+
These functions were part of the "old buffer protocol" API in Python 2.
9+
In Python 3, these functions are still exposed for ease of porting code.
10+
They act as a compatibility wrapper around the :ref:`new buffer API
11+
<bufferobjects>`, but they don't give you control over the lifetime of
12+
the resources acquired when a buffer is exported.
13+
14+
Therefore, it is recommended that you call :cfunc:`PyObject_GetBuffer`
15+
(or the ``y*`` or ``w*`` :ref:`format codes <arg-parsing>` with the
16+
:cfunc:`PyArg_ParseTuple` family of functions) to get a buffer view over
17+
an object, and :cfunc:`PyBuffer_Release` when the buffer view can be released.
18+
419

520
Buffer Protocol
621
===============

0 commit comments

Comments
 (0)