diff options
| author | Martin v. Löwis <martin@v.loewis.de> | 2008-08-12 14:49:50 +0000 |
|---|---|---|
| committer | Martin v. Löwis <martin@v.loewis.de> | 2008-08-12 14:49:50 +0000 |
| commit | f91d46a17d85da323895950852093117bc21f860 (patch) | |
| tree | c6a3e68cf22a6a102f9c1dc780438f0307b6588f /Doc/c-api | |
| parent | aa8efbf08469c3667ed22362c0e10b83ae124c0b (diff) | |
| download | cpython-git-f91d46a17d85da323895950852093117bc21f860.tar.gz | |
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/c-api')
| -rw-r--r-- | Doc/c-api/arg.rst | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/Doc/c-api/arg.rst b/Doc/c-api/arg.rst index 3deafdfbe0..5ceab58cd2 100644 --- a/Doc/c-api/arg.rst +++ b/Doc/c-api/arg.rst @@ -40,6 +40,14 @@ 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. + + .. versionadded:: 2.6 + ``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*. @@ -47,6 +55,10 @@ 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``. + .. versionadded:: 2.6 + ``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 @@ -240,6 +252,10 @@ 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``. + .. versionadded:: 2.6 + ``(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 |
