]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
Fix types in buffer/memoryview docs (GH-98118)
authorMiss Islington (bot) <31488909+miss-islington@users.noreply.github.com>
Mon, 10 Oct 2022 01:03:53 +0000 (18:03 -0700)
committerPablo Galindo <pablogsal@gmail.com>
Sat, 22 Oct 2022 19:04:49 +0000 (20:04 +0100)
The definition of obj in the `Py_buffer` struct is as a PyObject*
https://github.com/python/cpython/blob/ec091bd47e2f968b0d1631b9a8104283a7beeb1b/Include/pybuffer.hGH-L22

PyMemoryView_GET_BASE returns `.obj` - thus its return type
should be a PyObject* (or at least a void*). It definitely
doesn't return `Py_buffer`
(cherry picked from commit c459fedf7cfd5dadf72e088d789c7375b3a6e093)

Co-authored-by: da-woods <dw-git@d-woods.co.uk>
Doc/c-api/buffer.rst
Doc/c-api/memoryview.rst

index 05e131d06b909d17e6161c788794edae1f952dfb..a04062fb2a68f1dba62ed42ce738b53d688b0653 100644 (file)
@@ -99,7 +99,7 @@ a buffer, see :c:func:`PyObject_GetBuffer`.
       For :term:`contiguous` arrays, the value points to the beginning of
       the memory block.
 
-   .. c:member:: void *obj
+   .. c:member:: PyObject *obj
 
       A new reference to the exporting object. The reference is owned by
       the consumer and automatically decremented and set to ``NULL`` by
index 4d94b3f545f3279c1b7253a4acf525625d088f5d..ebd5c7760437bf3bc88b8fababbbe6664f10e2cc 100644 (file)
@@ -55,7 +55,7 @@ any other object.
    *mview* **must** be a memoryview instance; this macro doesn't check its type,
    you must do it yourself or you will risk crashes.
 
-.. c:function:: Py_buffer *PyMemoryView_GET_BASE(PyObject *mview)
+.. c:function:: PyObject *PyMemoryView_GET_BASE(PyObject *mview)
 
    Return either a pointer to the exporting object that the memoryview is based
    on or ``NULL`` if the memoryview has been created by one of the functions