numpy  2.0.0
src/multiarray/buffer.c File Reference
#include <Python.h>
#include "structmember.h"
#include "numpy/arrayobject.h"
#include "numpy/arrayscalars.h"
#include "npy_config.h"
#include "npy_pycompat.h"
#include "buffer.h"
#include "numpyos.h"
#include "arrayobject.h"

Defines

#define PY_SSIZE_T_CLEAN
#define NPY_NO_DEPRECATED_API   NPY_API_VERSION
#define _MULTIARRAYMODULE

Functions

static Py_ssize_t array_getsegcount (PyArrayObject *self, Py_ssize_t *lenp)
static Py_ssize_t array_getreadbuf (PyArrayObject *self, Py_ssize_t segment, void **ptrptr)
static Py_ssize_t array_getwritebuf (PyArrayObject *self, Py_ssize_t segment, void **ptrptr)
static Py_ssize_t array_getcharbuf (PyArrayObject *self, Py_ssize_t segment, constchar **ptrptr)
NPY_NO_EXPORT void _array_dealloc_buffer_info (PyArrayObject *self)
NPY_NO_EXPORT PyArray_Descr_descriptor_from_pep3118_format (char *s)

Variables

NPY_NO_EXPORT PyBufferProcs array_as_buffer

Define Documentation

#define NPY_NO_DEPRECATED_API   NPY_API_VERSION

Function Documentation

System Message: SEVERE/4 (<string>, line 1)
Missing matching underline for section title overline.

 PEP 3118 buffer protocol
 

<blockquote>

Implementing PEP 3118 is somewhat convoluted because of the desirata:

  • Don't add new members to ndarray or descr structs, to preserve binary compatibility. (Also, adding the items is actually not very useful, since mutability issues prevent an 1 to 1 relationship between arrays and buffer views.)
  • Don't use bf_releasebuffer, because it prevents PyArg_ParseTuple("s#", ... from working. Breaking this would cause several backward compatibility issues already on Python 2.6.
  • Behave correctly when array is reshaped in-place, or it's dtype is altered.
The solution taken below is to manually track memory allocated for Py_buffers. </blockquote>

System Message: WARNING/2 (<string>, line 20) Block quote ends without a blank line; unexpected unindent.

System Message: ERROR/3 (<string>, line 20) Document may not end with a transition.
System Message: SEVERE/4 (<string>, line 1)
Incomplete section title.

 Convert PEP 3118 format string to PyArray_Descr
static Py_ssize_t array_getcharbuf ( PyArrayObject self,
Py_ssize_t  segment,
constchar **  ptrptr 
) [static]
!defined(NPY_PY3K)
static Py_ssize_t array_getreadbuf ( PyArrayObject self,
Py_ssize_t  segment,
void **  ptrptr 
) [static]
static Py_ssize_t array_getsegcount ( PyArrayObject self,
Py_ssize_t *  lenp 
) [static]

*********** Implement Buffer Protocol ************************

System Message: WARNING/2 (<string>, line 1)
Title overline too short.

   Implement Buffer Protocol ****************************
 
removed multiple segment interface

References PyArray_DATA, PyArray_ISONESEGMENT, and PyArray_NBYTES.

static Py_ssize_t array_getwritebuf ( PyArrayObject self,
Py_ssize_t  segment,
void **  ptrptr 
) [static]

Variable Documentation

System Message: ERROR/3 (<string>, line 1) Document or section may not begin with a transition.

System Message: ERROR/3 (<string>, line 1) Document may not end with a transition.