Skip to content

Commit c459fed

Browse files
authored
Fix types in buffer/memoryview docs (python#98118)
The definition of obj in the `Py_buffer` struct is as a PyObject* https://github.com/python/cpython/blob/ec091bd47e2f968b0d1631b9a8104283a7beeb1b/Include/pybuffer.h#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`
1 parent 281a3f1 commit c459fed

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

Doc/c-api/buffer.rst

+1-1
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ a buffer, see :c:func:`PyObject_GetBuffer`.
9999
For :term:`contiguous` arrays, the value points to the beginning of
100100
the memory block.
101101

102-
.. c:member:: void *obj
102+
.. c:member:: PyObject *obj
103103
104104
A new reference to the exporting object. The reference is owned by
105105
the consumer and automatically decremented and set to ``NULL`` by

Doc/c-api/memoryview.rst

+1-1
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ any other object.
5555
*mview* **must** be a memoryview instance; this macro doesn't check its type,
5656
you must do it yourself or you will risk crashes.
5757
58-
.. c:function:: Py_buffer *PyMemoryView_GET_BASE(PyObject *mview)
58+
.. c:function:: PyObject *PyMemoryView_GET_BASE(PyObject *mview)
5959
6060
Return either a pointer to the exporting object that the memoryview is based
6161
on or ``NULL`` if the memoryview has been created by one of the functions

0 commit comments

Comments
 (0)