内存视图对象

A memoryview object exposes the C level 缓冲接口 as a Python object which can then be passed around like any other object.

PyObject * PyMemoryView_FromObject ( PyObject * obj )
返回值:新引用。 属于 稳定 ABI (应用程序二进制接口) .

Create a memoryview object from an object that provides the buffer interface. If obj supports writable buffer exports, the memoryview object will be read/write, otherwise it may be either read-only or read/write at the discretion of the exporter.

PyBUF_READ

Flag to request a readonly buffer.

PyBUF_WRITE

Flag to request a writable buffer.

PyObject * PyMemoryView_FromMemory ( char * mem , Py_ssize_t size , int flags )
返回值:新引用。 属于 稳定 ABI (应用程序二进制接口) since version 3.7.

Create a memoryview object using mem as the underlying buffer. flags can be one of PyBUF_READ or PyBUF_WRITE .

Added in version 3.3.