summaryrefslogtreecommitdiffstats
path: root/Doc/c-api/buffer.rst
diff options
context:
space:
mode:
authorBenjamin Peterson <benjamin@python.org>2009-08-26 07:38:00 (GMT)
committerBenjamin Peterson <benjamin@python.org>2009-08-26 07:38:00 (GMT)
commit122caa0f27364ae2fd225417792f8c00dc4524c5 (patch)
tree79fa0c950ecee7f89873a37534ca0928b5f1ac20 /Doc/c-api/buffer.rst
parentb08c3a818eb6f2fef3ce86c8ba8ae99bbe0be6c3 (diff)
downloadcpython-122caa0f27364ae2fd225417792f8c00dc4524c5.zip
cpython-122caa0f27364ae2fd225417792f8c00dc4524c5.tar.gz
cpython-122caa0f27364ae2fd225417792f8c00dc4524c5.tar.bz2
Merged revisions 74551 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/branches/py3k ........ r74551 | benjamin.peterson | 2009-08-26 09:35:45 +0200 (Wed, 26 Aug 2009) | 1 line the old buffer object doesn't exist in Python 3 #6659 ........
Diffstat (limited to 'Doc/c-api/buffer.rst')
-rw-r--r--Doc/c-api/buffer.rst20
1 files changed, 15 insertions, 5 deletions
diff --git a/Doc/c-api/buffer.rst b/Doc/c-api/buffer.rst
index 97adb07..ec44a99 100644
--- a/Doc/c-api/buffer.rst
+++ b/Doc/c-api/buffer.rst
@@ -10,7 +10,6 @@ Buffer Objects
.. index::
- object: buffer
single: buffer interface
Python objects implemented in C can export a "buffer interface." These
@@ -297,14 +296,25 @@ Buffer related functions
length. Return 0 on success and -1 (with raising an error) on error.
+.. index::
+ object: memoryview
+
+
MemoryView objects
==================
-A memoryview object is an extended buffer object that could replace the buffer
-object (but doesn't have to as that could be kept as a simple 1-d memoryview
-object). It, unlike :ctype:`Py_buffer`, is a Python object (exposed as
-:class:`memoryview` in :mod:`builtins`), so it can be used with Python code.
+A memoryview object exposes the C level buffer interface to Python.
+
.. cfunction:: PyObject* PyMemoryView_FromObject(PyObject *obj)
Return a memoryview object from an object that defines the buffer interface.
+
+
+.. cfunction:: PyObject * PyMemoryView_GetContiguous(PyObject *obj, int buffertype, char order)
+
+ Return a memoryview object to a contiguous chunk of memory (in either
+ 'C' or 'F'ortran order) from an object that defines the buffer
+ interface. If memory is contiguous, the memoryview object points to the
+ original memory. Otherwise copy is made and the memoryview points to a
+ new bytes object.