summaryrefslogtreecommitdiffstats
path: root/Doc
diff options
context:
space:
mode:
authorMartin v. Löwis <martin@v.loewis.de>2008-08-13 15:53:07 (GMT)
committerMartin v. Löwis <martin@v.loewis.de>2008-08-13 15:53:07 (GMT)
commit423be95dcf55b0b8737207beb7b30eb549430dba (patch)
treeb23453f2dc43d809aca931203a9580a81bd938fe /Doc
parent688356f59f3b0fe2412a5f66b79f0f9fdc4a98d2 (diff)
downloadcpython-423be95dcf55b0b8737207beb7b30eb549430dba.zip
cpython-423be95dcf55b0b8737207beb7b30eb549430dba.tar.gz
cpython-423be95dcf55b0b8737207beb7b30eb549430dba.tar.bz2
Merged revisions 65654 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk ........ r65654 | martin.v.loewis | 2008-08-12 16:49:50 +0200 (Tue, 12 Aug 2008) | 6 lines Issue #3139: Make buffer-interface thread-safe wrt. PyArg_ParseTuple, by denying s# to parse objects that have a releasebuffer procedure, and introducing s*. More module might need to get converted to use s*. ........
Diffstat (limited to 'Doc')
-rw-r--r--Doc/c-api/arg.rst15
-rw-r--r--Doc/whatsnew/2.6.rst4
2 files changed, 17 insertions, 2 deletions
diff --git a/Doc/c-api/arg.rst b/Doc/c-api/arg.rst
index faf97ed..de7b930 100644
--- a/Doc/c-api/arg.rst
+++ b/Doc/c-api/arg.rst
@@ -40,6 +40,12 @@ variable(s) whose address should be passed.
other read-buffer compatible objects pass back a reference to the raw internal
data representation.
+``s*`` (string, Unicode, or any buffer compatible object) [Py_buffer \*]
+ Similar to ``s#``, this code fills a Py_buffer structure provided by the caller.
+ The buffer gets locked, so that the caller can subsequently use the buffer even
+ inside a ``Py_BEGIN_ALLOW_THREADS`` block; the caller is responsible for calling
+ ``PyBuffer_Release`` with the structure after it has processed the data.
+
``y`` (bytes object) [const char \*]
This variant on ``s`` convert a Python bytes object to a C pointer to a
character string. The bytes object must not contain embedded NUL bytes; if it
@@ -49,6 +55,9 @@ variable(s) whose address should be passed.
This variant on ``s#`` stores into two C variables, the first one a pointer to a
character string, the second one its length. This only accepts bytes objects.
+``y*`` (bytes object) [Py_buffer \*]
+ This is to ``s*`` as ``y`` is to ``s``.
+
``z`` (string or ``None``) [const char \*]
Like ``s``, but the Python object may also be ``None``, in which case the C
pointer is set to *NULL*.
@@ -56,6 +65,9 @@ variable(s) whose address should be passed.
``z#`` (string or ``None`` or any read buffer compatible object) [const char \*, int]
This is to ``s#`` as ``z`` is to ``s``.
+``z*`` (string or ``None`` or any buffer compatible object) [Py_buffer*]
+ This is to ``s*`` as ``z`` is to ``s``.
+
``u`` (Unicode object) [Py_UNICODE \*]
Convert a Python Unicode object to a C pointer to a NUL-terminated buffer of
16-bit Unicode (UTF-16) data. As with ``s``, there is no need to provide
@@ -244,6 +256,9 @@ variable(s) whose address should be passed.
single-segment buffer objects are accepted; :exc:`TypeError` is raised for all
others.
+``w*`` (read-write byte-oriented buffer) [Py_buffer \*]
+ This is to ``w`` what ``s*`` is to ``s``.
+
``(items)`` (tuple) [*matching-items*]
The object must be a Python sequence whose length is the number of format units
in *items*. The C arguments must correspond to the individual format units in
diff --git a/Doc/whatsnew/2.6.rst b/Doc/whatsnew/2.6.rst
index c0ecf01..0f8b883 100644
--- a/Doc/whatsnew/2.6.rst
+++ b/Doc/whatsnew/2.6.rst
@@ -1064,7 +1064,7 @@ about the object's memory representation. Objects
can use this operation to lock memory in place
while an external caller could be modifying the contents,
so there's a corresponding
-``PyObject_ReleaseBuffer(PyObject *obj, Py_buffer *view)`` to
+``PyBuffer_Release(Py_buffer *view)`` to
indicate that the external caller is done.
The **flags** argument to :cfunc:`PyObject_GetBuffer` specifies
@@ -2841,7 +2841,7 @@ Changes to Python's build process and to the C API include:
* The new buffer interface, previously described in
`the PEP 3118 section <#pep-3118-revised-buffer-protocol>`__,
- adds :cfunc:`PyObject_GetBuffer` and :cfunc:`PyObject_ReleaseBuffer`,
+ adds :cfunc:`PyObject_GetBuffer` and :cfunc:`PyBuffer_Release`,
as well as a few other functions.
* Python's use of the C stdio library is now thread-safe, or at least