Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
cpython
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
cpython
Commits
a2bb5d19
Commit
a2bb5d19
authored
Aug 04, 1999
by
Fred Drake
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Started documentation on buffer objects & types. Very preliminary.
Greg Stein: Please help with this; it's your baby!
parent
cc06ea46
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
66 additions
and
1 deletion
+66
-1
Doc/api/api.tex
Doc/api/api.tex
+66
-1
No files found.
Doc/api/api.tex
View file @
a2bb5d19
...
...
@@ -1828,6 +1828,60 @@ Macro form of \cfunction{PyString_GetSize()} but without error checking.
\end{cfuncdesc}
\subsection
{
Buffer Objects
\label
{
bufferObjects
}}
XXX need a real description of buffers and buffer ''segments.``
\begin{cvardesc}
{
PyTypeObject
}{
PyBuffer
_
Type
}
The instance of
\ctype
{
PyTypeObject
}
which represents the Python
buffer type.
\end{cvardesc}
\begin{cvardesc}
{
int
}{
Py
_
END
_
OF
_
BUFFER
}
Constant returned by
\cfunction
{
Py
}
\end{cvardesc}
\begin{cfuncdesc}
{
int
}{
PyBuffer
_
Check
}{
PyObject *p
}
Return true if the argument has type
\cdata
{
PyBuffer
_
Type
}
.
\end{cfuncdesc}
\begin{cfuncdesc}
{
PyObject*
}{
PyBuffer
_
FromObject
}{
PyObject *base,
int offset, int size
}
Return a new read-only buffer object.
Raises
\exception
{
TypeError
}
if
\var
{
base
}
doesn't support the
read-only buffer protocol or doesn't provide exactly one buffer
segment. Raises
\exception
{
ValueError
}
if
\var
{
offset
}
is less than
zero.
\end{cfuncdesc}
\begin{cfuncdesc}
{
PyObject*
}{
PyBuffer
_
FromReadWriteObject
}{
PyObject *base,
int offset,
int size
}
Return a new writable buffer object. Parameters and exceptions are
similar to those for
\cfunction
{
PyBuffer
_
FromObject()
}
.
\end{cfuncdesc}
\begin{cfuncdesc}
{
PyObject*
}{
PyBuffer
_
FromMemory
}{
void *ptr, int size
}
Return a new read-only buffer object that reads from a memory buffer.
The caller is responsible for ensuring that the memory buffer, passed
in as
\var
{
ptr
}
, is not deallocated while the returned buffer object
exists. Raises
\exception
{
ValueError
}
if
\var
{
size
}
is less than
zero.
\end{cfuncdesc}
\begin{cfuncdesc}
{
PyObject*
}{
PyBuffer
_
FromReadWriteMemory
}{
void *ptr, int size
}
Return a new writable buffer object that reads from and writes to a
memory buffer. The caller is responsible for ensuring that the memory
buffer, passed in as
\var
{
ptr
}
, is not deallocated while the returned
buffer object exists. Raises
\exception
{
ValueError
}
if
\var
{
size
}
is
less than zero.
\end{cfuncdesc}
\begin{cfuncdesc}
{
PyObject*
}{
PyBuffer
_
New
}{
int size
}
Returns a new writable buffer object that maintains its own memory
buffer of
\var
{
size
}
bytes.
\var
{
size
}
must be zero or positive.
\end{cfuncdesc}
\subsection
{
Tuple Objects
\label
{
tupleObjects
}}
...
...
@@ -3029,10 +3083,21 @@ PyObject_HEAD, PyObject_HEAD_INIT, PyObject_VAR_HEAD
Typedefs:
unaryfunc, binaryfunc, ternaryfunc, inquiry, coercion, intargfunc,
intintargfunc, intobjargproc, intintobjargproc, objobjargproc,
getreadbufferproc, get
writebufferproc, getsegcount
proc,
getreadbufferproc, get
segcountproc, getcharbuffer
proc,
destructor, printfunc, getattrfunc, getattrofunc, setattrfunc,
setattrofunc, cmpfunc, reprfunc, hashfunc
\begin{ctypedesc}
{
int (*getwritebufferproc) (PyObject *self, int segment,
void **ptrptr)
}
Return a pointer to a writable memory buffer in
\code
{
*
\var
{
ptrptr
}}
;
the memory buffer must correspond to buffer segment
\var
{
segment
}
.
Must return
\code
{
-1
}
and set an exception on error.
\exception
{
TypeError
}
should be raised if the object only supports
read-only buffers, and
\exception
{
SystemError
}
should be raised when
\var
{
segment
}
specifies a segment that doesn't exist.
% Why doesn't it raise ValueError for this one?
\end{ctypedesc}
PyNumberMethods
PySequenceMethods
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment