Skip to content

Latest commit

 

History

History
51 lines (34 loc) · 2.15 KB

objbuffer.rst

File metadata and controls

51 lines (34 loc) · 2.15 KB

c

旧的缓冲协议

3.0

These functions were part of the "old buffer protocol" API in Python 2. In Python 3, this protocol doesn't exist anymore but the functions are still exposed to ease porting 2.x code. They act as a compatibility wrapper around the new buffer protocol <bufferobjects>, but they don't give you control over the lifetime of the resources acquired when a buffer is exported.

Therefore, it is recommended that you call :cPyObject_GetBuffer (or the y* or w* format codes <arg-parsing> with the :cPyArg_ParseTuple family of functions) to get a buffer view over an object, and :cPyBuffer_Release when the buffer view can be released.