Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 0f46ffd

Browse files
committed
the old buffer object doesn't exist in Python 3 #6659
1 parent f3b3322 commit 0f46ffd

1 file changed

Lines changed: 15 additions & 5 deletions

File tree

Doc/c-api/buffer.rst

Lines changed: 15 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@ Buffer Objects
1010

1111

1212
.. index::
13-
object: buffer
1413
single: buffer interface
1514

1615
Python objects implemented in C can export a "buffer interface." These
@@ -297,14 +296,25 @@ Buffer related functions
297296
length. Return 0 on success and -1 (with raising an error) on error.
298297

299298

299+
.. index::
300+
object: memoryview
301+
302+
300303
MemoryView objects
301304
==================
302305

303-
A memoryview object is an extended buffer object that could replace the buffer
304-
object (but doesn't have to as that could be kept as a simple 1-d memoryview
305-
object). It, unlike :ctype:`Py_buffer`, is a Python object (exposed as
306-
:class:`memoryview` in :mod:`builtins`), so it can be used with Python code.
306+
A memoryview object exposes the C level buffer interface to Python.
307+
307308

308309
.. cfunction:: PyObject* PyMemoryView_FromObject(PyObject *obj)
309310

310311
Return a memoryview object from an object that defines the buffer interface.
312+
313+
314+
.. cfunction:: PyObject * PyMemoryView_GetContiguous(PyObject *obj, int buffertype, char order)
315+
316+
Return a memoryview object to a contiguous chunk of memory (in either
317+
'C' or 'F'ortran order) from an object that defines the buffer
318+
interface. If memory is contiguous, the memoryview object points to the
319+
original memory. Otherwise copy is made and the memoryview points to a
320+
new bytes object.

0 commit comments

Comments
 (0)