summaryrefslogtreecommitdiffstats
path: root/Doc/c-api
diff options
context:
space:
mode:
authorChristian Heimes <christian@python.org>2022-02-02 15:03:10 (GMT)
committerGitHub <noreply@github.com>2022-02-02 15:03:10 (GMT)
commitf66c857572a308822c70fd25e0197b6e0dec6e34 (patch)
tree0014ec4456f837b05462e172655e194385e2ec61 /Doc/c-api
parent08f8301b21648d58d053e1a513db8ed32fbf37dd (diff)
downloadcpython-f66c857572a308822c70fd25e0197b6e0dec6e34.zip
cpython-f66c857572a308822c70fd25e0197b6e0dec6e34.tar.gz
cpython-f66c857572a308822c70fd25e0197b6e0dec6e34.tar.bz2
bpo-45459: Add Py_buffer to limited API (GH-29991)
- [x] ``Py_buffer`` struct - [x] ``PyBuffer_*()`` API functions - [x] ``PyBUF_*`` constants - [x] ``Py_bf_getbuffer`` and ``Py_bf_releasebuffer`` type slots - [x] ``PyMemoryView_FromBuffer()`` API - [x] tests for limited API - [x] ``make regen-limited-abi`` - [x] documentation update - [ ] export ``PyPickleBuffer*()`` API ???
Diffstat (limited to 'Doc/c-api')
-rw-r--r--Doc/c-api/buffer.rst7
-rw-r--r--Doc/c-api/type.rst11
2 files changed, 12 insertions, 6 deletions
diff --git a/Doc/c-api/buffer.rst b/Doc/c-api/buffer.rst
index 820a3a6..05e131d 100644
--- a/Doc/c-api/buffer.rst
+++ b/Doc/c-api/buffer.rst
@@ -499,6 +499,13 @@ Buffer-related functions
This function fails if *len* != *src->len*.
+.. c:function:: int PyObject_CopyData(Py_buffer *dest, Py_buffer *src)
+
+ Copy data from *src* to *dest* buffer. Can convert between C-style and
+ or Fortran-style buffers.
+
+ ``0`` is returned on success, ``-1`` on error.
+
.. c:function:: void PyBuffer_FillContiguousStrides(int ndims, Py_ssize_t *shape, Py_ssize_t *strides, int itemsize, char order)
Fill the *strides* array with byte-strides of a :term:`contiguous` (C-style if
diff --git a/Doc/c-api/type.rst b/Doc/c-api/type.rst
index f968869..97a818a 100644
--- a/Doc/c-api/type.rst
+++ b/Doc/c-api/type.rst
@@ -272,12 +272,6 @@ The following functions and structs are used to create
* :c:member:`~PyTypeObject.tp_vectorcall_offset`
(see :ref:`PyMemberDef <pymemberdef-offsets>`)
- The following fields cannot be set using :c:type:`PyType_Spec` and
- :c:type:`PyType_Slot` under the limited API:
-
- * :c:member:`~PyBufferProcs.bf_getbuffer`
- * :c:member:`~PyBufferProcs.bf_releasebuffer`
-
Setting :c:data:`Py_tp_bases` or :c:data:`Py_tp_base` may be
problematic on some platforms.
To avoid issues, use the *bases* argument of
@@ -287,6 +281,11 @@ The following functions and structs are used to create
Slots in :c:type:`PyBufferProcs` in may be set in the unlimited API.
+ .. versionchanged:: 3.11
+ :c:member:`~PyBufferProcs.bf_getbuffer` and
+ :c:member:`~PyBufferProcs.bf_releasebuffer` are now available
+ under limited API.
+
.. c:member:: void *PyType_Slot.pfunc
The desired value of the slot. In most cases, this is a pointer