summaryrefslogtreecommitdiffstats
path: root/Doc/api
diff options
context:
space:
mode:
authorJeremy Hylton <jeremy@alum.mit.edu>2001-11-09 21:59:42 (GMT)
committerJeremy Hylton <jeremy@alum.mit.edu>2001-11-09 21:59:42 (GMT)
commit89c3a22a2788cb85b89990543e33236cd60ba307 (patch)
treec7da0d69ab040e3e3f3f5b94752bf182d7b205c9 /Doc/api
parentda4ffeecf5106250ce1cb184b22f0c7e691e9f74 (diff)
downloadcpython-89c3a22a2788cb85b89990543e33236cd60ba307.zip
cpython-89c3a22a2788cb85b89990543e33236cd60ba307.tar.gz
cpython-89c3a22a2788cb85b89990543e33236cd60ba307.tar.bz2
Add PyObject_CheckReadBuffer(), which returns true if its argument
supports the single-segment readable buffer interface. Add documentation for this and other PyObject_XXXBuffer() calls.
Diffstat (limited to 'Doc/api')
-rw-r--r--Doc/api/abstract.tex39
1 files changed, 39 insertions, 0 deletions
diff --git a/Doc/api/abstract.tex b/Doc/api/abstract.tex
index 3078e90..c6a19c2 100644
--- a/Doc/api/abstract.tex
+++ b/Doc/api/abstract.tex
@@ -867,4 +867,43 @@ if (PyErr_Occurred()) {
else {
/* continue doing useful work */
}
+
+\section{Buffer Protocol \label{buffer}}
+
+\begin{cfuncdesc}{int}{PyObject_AsCharBuffer}{PyObject *obj,
+ const char **buffer,
+ int *buffer_len}
+ Returns a pointer to a read-only memory location useable as character-
+ based input. The \var{obj} argument must support the single-segment
+ character buffer interface. On success, returns \code{1}, sets
+ \var{buffer} to the memory location and \var{buffer} to the buffer
+ length. Returns \code{0} and sets a \exception{TypeError} on error.
+\end{cfuncdesc}
+
+\begin{cfuncdesc}{int}{PyObject_AsReadBuffer}{PyObject *obj,
+ const char **buffer,
+ int *buffer_len}
+ Returns a pointer to a read-only memory location containing
+ arbitrary data. The \var{obj} argument must support the
+ single-segment readable buffer interface. On success, returns
+ \code{1}, sets \var{buffer} to the memory location and \var{buffer}
+ to the buffer length. Returns \code{0} and sets a
+ \exception{TypeError} on error.
+\end{cfuncdesc}
+
+\begin{cfuncdesc}{int}{PyObject_CheckReadBuffer}{PyObject *o}
+ Returns \code{1} if \var{o} supports the single-segment readable
+ buffer interface. Otherwise returns \code{0}.
+\enc{cfuncdesc}
+
+\begin{cfuncdesc}{int}{PyObject_AsWriteBuffer}{PyObject *obj,
+ const char **buffer,
+ int *buffer_len}
+ Returns a pointer to a writeable memory location. The \var{obj}
+ argument must support the single-segment, character buffer
+ interface. On success, returns \code{1}, sets \var{buffer} to the
+ memory location and \var{buffer} to the buffer length. Returns
+ \code{0} and sets a \exception{TypeError} on error.
+\end{cfuncdesc}
+
\end{verbatim}