Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 6aec9be

Browse files
author
Victor Stinner
committed
Merged revisions 81923 via svnmerge from
svn+ssh://[email protected]/python/branches/py3k ........ r81923 | victor.stinner | 2010-06-12 01:30:12 +0200 (sam., 12 juin 2010) | 16 lines Fix some bugs in c-api/arg.rst documentation * replace "the default encoding" by "'utf-8' encoding" * fix "w" / "w*" / "w#" doc: similar to "y" / "y*" / "y#" and not "s" / "s*" / "s#" * "u#": remove "Non-Unicode objects are handled by interpreting their read-buffer pointer ...", it's no more true * "es", "es#": remove "... and objects convertible to Unicode into a character buffer", it's no more true * Py_BuildValue(), "K" and "L" formats: specify the name of the C type on Windows (_int64 / unsigned _int64) as done for PyArg_Parse*() long long types --CETTE ligne, et les suivantes ci-dessous, seront ignorées-- M Doc/c-api/arg.rst ........
1 parent 829eab1 commit 6aec9be

1 file changed

Lines changed: 15 additions & 16 deletions

File tree

Doc/c-api/arg.rst

Lines changed: 15 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -133,9 +133,7 @@ Unless otherwise stated, buffers are not NUL-terminated.
133133

134134
``u#`` (:class:`str`) [Py_UNICODE \*, int]
135135
This variant on ``u`` stores into two C variables, the first one a pointer to a
136-
Unicode data buffer, the second one its length. Non-Unicode objects are handled
137-
by interpreting their read-buffer pointer as pointer to a :ctype:`Py_UNICODE`
138-
array.
136+
Unicode data buffer, the second one its length.
139137

140138
``Z`` (:class:`str` or ``None``) [Py_UNICODE \*]
141139
Like ``u``, but the Python object may also be ``None``, in which case the
@@ -158,29 +156,28 @@ Unless otherwise stated, buffers are not NUL-terminated.
158156
others.
159157

160158
``w`` (:class:`bytearray` or read-write character buffer) [char \*]
161-
Similar to ``s``, but accepts any object which implements the read-write buffer
159+
Similar to ``y``, but accepts any object which implements the read-write buffer
162160
interface. The caller must determine the length of the buffer by other means,
163161
or use ``w#`` instead. Only single-segment buffer objects are accepted;
164162
:exc:`TypeError` is raised for all others.
165163

166164
``w*`` (:class:`bytearray` or read-write byte-oriented buffer) [Py_buffer]
167-
This is to ``w`` what ``s*`` is to ``s``.
165+
This is to ``w`` what ``y*`` is to ``y``.
168166

169167
``w#`` (:class:`bytearray` or read-write character buffer) [char \*, int]
170-
Like ``s#``, but accepts any object which implements the read-write buffer
168+
Like ``y#``, but accepts any object which implements the read-write buffer
171169
interface. The :ctype:`char \*` variable is set to point to the first byte
172170
of the buffer, and the :ctype:`int` is set to the length of the buffer.
173171
Only single-segment buffer objects are accepted; :exc:`TypeError` is raised
174172
for all others.
175173

176174
``es`` (:class:`str`) [const char \*encoding, char \*\*buffer]
177-
This variant on ``s`` is used for encoding Unicode and objects convertible to
178-
Unicode into a character buffer. It only works for encoded data without embedded
179-
NUL bytes.
175+
This variant on ``s`` is used for encoding Unicode into a character buffer.
176+
It only works for encoded data without embedded NUL bytes.
180177

181178
This format requires two arguments. The first is only used as input, and
182179
must be a :ctype:`const char\*` which points to the name of an encoding as a
183-
NUL-terminated string, or *NULL*, in which case the default encoding is used.
180+
NUL-terminated string, or *NULL*, in which case ``'utf-8'`` encoding is used.
184181
An exception is raised if the named encoding is not known to Python. The
185182
second argument must be a :ctype:`char\*\*`; the value of the pointer it
186183
references will be set to a buffer with the contents of the argument text.
@@ -197,13 +194,13 @@ Unless otherwise stated, buffers are not NUL-terminated.
197194
the encoding passed in as parameter.
198195

199196
``es#`` (:class:`str`) [const char \*encoding, char \*\*buffer, int \*buffer_length]
200-
This variant on ``s#`` is used for encoding Unicode and objects convertible to
201-
Unicode into a character buffer. Unlike the ``es`` format, this variant allows
202-
input data which contains NUL characters.
197+
This variant on ``s#`` is used for encoding Unicode into a character buffer.
198+
Unlike the ``es`` format, this variant allows input data which contains NUL
199+
characters.
203200

204201
It requires three arguments. The first is only used as input, and must be a
205202
:ctype:`const char\*` which points to the name of an encoding as a
206-
NUL-terminated string, or *NULL*, in which case the default encoding is used.
203+
NUL-terminated string, or *NULL*, in which case ``'utf-8'`` encoding is used.
207204
An exception is raised if the named encoding is not known to Python. The
208205
second argument must be a :ctype:`char\*\*`; the value of the pointer it
209206
references will be set to a buffer with the contents of the argument text.
@@ -556,11 +553,13 @@ Building values
556553

557554
``L`` (:class:`int`) [PY_LONG_LONG]
558555
Convert a C :ctype:`long long` to a Python integer object. Only available
559-
on platforms that support :ctype:`long long`.
556+
on platforms that support :ctype:`long long` (or :ctype:`_int64` on
557+
Windows).
560558

561559
``K`` (:class:`int`) [unsigned PY_LONG_LONG]
562560
Convert a C :ctype:`unsigned long long` to a Python integer object. Only
563-
available on platforms that support :ctype:`unsigned long long`.
561+
available on platforms that support :ctype:`unsigned long long` (or
562+
:ctype:`unsigned _int64` on Windows).
564563

565564
``n`` (:class:`int`) [Py_ssize_t]
566565
Convert a C :ctype:`Py_ssize_t` to a Python integer.

0 commit comments

Comments
 (0)