]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
Add the PyObject_As*Buffer() functions that apply, now that the docs have been
authorFred Drake <fdrake@acm.org>
Thu, 4 Apr 2002 04:21:23 +0000 (04:21 +0000)
committerFred Drake <fdrake@acm.org>
Thu, 4 Apr 2002 04:21:23 +0000 (04:21 +0000)
corrected and I'm dealing with them anyway.

Doc/api/api.tex

index 62e2eafd0d30fc08992d9dd0ea0f047a54bc17d3..c0173c7c65d4e37eeacc219d0b6e01d981fa865b 100644 (file)
@@ -2117,6 +2117,43 @@ statement \samp{\var{o}[\var{key}] = \var{v}}.
 \end{cfuncdesc}
 
 
+\section{Buffer Protocol \label{abstract-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{0}, sets
+  \var{buffer} to the memory location and \var{buffer_len} to the buffer
+  length.  Returns \code{-1} and sets a \exception{TypeError} on error.
+  \versionadded{1.6}
+\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{0}, sets \var{buffer} to the memory location and \var{buffer_len}
+  to the buffer length.  Returns \code{-1} and sets a
+  \exception{TypeError} on error.
+  \versionadded{1.6}
+\end{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{0}, sets \var{buffer} to the
+  memory location and \var{buffer_len} to the buffer length.  Returns
+  \code{-1} and sets a \exception{TypeError} on error.
+  \versionadded{1.6}
+\end{cfuncdesc}
+
+
 \chapter{Concrete Objects Layer \label{concrete}}
 
 The functions in this chapter are specific to certain Python object