Table of Contents | Iterator Protocol | Old Buffer Protocol | Report a Bug | index | modules | Python | 3.9.25 Documentation | Python/C API Reference Manual | Abstract Objects Layer
Tin mới
Python documentation for the current stable release
Certain objects available in Python wrap access to an underlying memory array or buffer. Such objects include the built-in bytes and bytearray, and some extension types like array.array. Third-party libraries may define
on the producer side, a type can export a “buffer interface” which allows objects of that type to expose information about their underlying buffer. This interface is described in the section Buffer Object Structures;
Certain objects available in Python wrap access to an underlying memory array or buffer. Such objects include the built-in bytes and bytearray, and some extension types like array.array. Third-party libraries may define
call PyArg_ParseTuple() (or one of its siblings) with one of the y*, w* or s* format codes.
A new reference to the exporting object. The reference is owned by the consumer and automatically decremented and set to NULL by PyBuffer_Release(). The field is the equivalent of the return value of any standard C-API f
struct: Interpret bytes as packed binary data.
A NUL terminated string in struct module style syntax describing the contents of a single item. If this is NULL, "B" (unsigned bytes) is assumed.
C or Fortran contiguity can be explicitly requested, with and without stride information. Without stride information, the buffer must be C-contiguous.