summaryrefslogtreecommitdiffstats
path: root/Doc/c-api/arg.rst
diff options
context:
space:
mode:
authorVictor Stinner <victor.stinner@haypocalc.com>2010-04-03 08:40:16 (GMT)
committerVictor Stinner <victor.stinner@haypocalc.com>2010-04-03 08:40:16 (GMT)
commitf70c5810565728b29a375492d5c3a37c5aa9af91 (patch)
tree0ef658879a929935495e04e9c69b71610cf01dee /Doc/c-api/arg.rst
parent0000295fe3b316f78732d543e15ae69efe168bed (diff)
downloadcpython-f70c5810565728b29a375492d5c3a37c5aa9af91.zip
cpython-f70c5810565728b29a375492d5c3a37c5aa9af91.tar.gz
cpython-f70c5810565728b29a375492d5c3a37c5aa9af91.tar.bz2
Issue #8227: Fix C API documentation, argument parsing
* 'z', 'z#', 'z*' does also accept Unicode * unify types name: replace "string or Unicode objet" by "string or Unicode"
Diffstat (limited to 'Doc/c-api/arg.rst')
-rw-r--r--Doc/c-api/arg.rst20
1 files changed, 10 insertions, 10 deletions
diff --git a/Doc/c-api/arg.rst b/Doc/c-api/arg.rst
index 2ffba93..6599d82 100644
--- a/Doc/c-api/arg.rst
+++ b/Doc/c-api/arg.rst
@@ -24,7 +24,7 @@ the format unit; the entry in (round) parentheses is the Python object type
that matches the format unit; and the entry in [square] brackets is the type
of the C variable(s) whose address should be passed.
-``s`` (string or Unicode object) [const char \*]
+``s`` (string or Unicode) [const char \*]
Convert a Python string or Unicode object to a C pointer to a character
string. You must not provide storage for the string itself; a pointer to
an existing string is stored into the character pointer variable whose
@@ -55,32 +55,32 @@ of the C variable(s) whose address should be passed.
.. versionadded:: 2.6
-``z`` (string or ``None``) [const char \*]
+``z`` (string, Unicode or ``None``) [const char \*]
Like ``s``, but the Python object may also be ``None``, in which case the C
pointer is set to *NULL*.
-``z#`` (string or ``None`` or any read buffer compatible object) [const char \*, int]
+``z#`` (string, Unicode, ``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]
+``z*`` (string, Unicode, ``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 \*]
+``u`` (Unicode) [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 storage for the Unicode data buffer; a pointer to the existing
Unicode data is stored into the :ctype:`Py_UNICODE` pointer variable whose
address you pass.
-``u#`` (Unicode object) [Py_UNICODE \*, int]
+``u#`` (Unicode) [Py_UNICODE \*, int]
This variant on ``u`` stores into two C variables, the first one a pointer
to a Unicode data buffer, the second one its length. Non-Unicode objects
are handled by interpreting their read-buffer pointer as pointer to a
:ctype:`Py_UNICODE` array.
-``es`` (string, Unicode object or character buffer compatible object) [const char \*encoding, char \*\*buffer]
+``es`` (string, Unicode or character buffer compatible object) [const char \*encoding, char \*\*buffer]
This variant on ``s`` is used for encoding Unicode and objects convertible
to Unicode into a character buffer. It only works for encoded data without
embedded NUL bytes.
@@ -99,12 +99,12 @@ of the C variable(s) whose address should be passed.
newly allocated storage. The caller is responsible for calling
:cfunc:`PyMem_Free` to free the allocated buffer after use.
-``et`` (string, Unicode object or character buffer compatible object) [const char \*encoding, char \*\*buffer]
+``et`` (string, Unicode or character buffer compatible object) [const char \*encoding, char \*\*buffer]
Same as ``es`` except that 8-bit string objects are passed through without
recoding them. Instead, the implementation assumes that the string object
uses the encoding passed in as parameter.
-``es#`` (string, Unicode object or character buffer compatible object) [const char \*encoding, char \*\*buffer, int \*buffer_length]
+``es#`` (string, Unicode or character buffer compatible object) [const char \*encoding, char \*\*buffer, int \*buffer_length]
This variant on ``s#`` is used for encoding Unicode and objects convertible
to Unicode into a character buffer. Unlike the ``es`` format, this variant
allows input data which contains NUL characters.
@@ -136,7 +136,7 @@ of the C variable(s) whose address should be passed.
In both cases, *\*buffer_length* is set to the length of the encoded data
without the trailing NUL byte.
-``et#`` (string, Unicode object or character buffer compatible object) [const char \*encoding, char \*\*buffer, int \*buffer_length]
+``et#`` (string, Unicode or character buffer compatible object) [const char \*encoding, char \*\*buffer, int \*buffer_length]
Same as ``es#`` except that string objects are passed through without
recoding them. Instead, the implementation assumes that the string object
uses the encoding passed in as parameter.