Issue #8850: Remove "w" and "w#" formats from PyArg_Parse*() functions, use

"w*" format instead. Add tests for "w*" format.
This commit is contained in:
Victor Stinner 2010-06-25 00:02:38 +00:00
parent 21e09487ac
commit 25e8ec4724
6 changed files with 61 additions and 64 deletions

View file

@ -150,21 +150,11 @@ Unless otherwise stated, buffers are not NUL-terminated.
any conversion. Raises :exc:`TypeError` if the object is not a Unicode
object. The C variable may also be declared as :ctype:`PyObject\*`.
``w`` (:class:`bytearray` or read-write character buffer) [char \*]
Similar to ``y``, but accepts any object which implements the read-write buffer
interface. The caller must determine the length of the buffer by other means,
or use ``w#`` instead. Only single-segment buffer objects are accepted;
:exc:`TypeError` is raised for all others.
``w*`` (:class:`bytearray` or read-write byte-oriented buffer) [Py_buffer]
This is to ``w`` what ``y*`` is to ``y``.
``w#`` (:class:`bytearray` or read-write character buffer) [char \*, int]
Like ``y#``, but accepts any object which implements the read-write buffer
interface. The :ctype:`char \*` variable is set to point to the first byte
of the buffer, and the :ctype:`int` is set to the length of the buffer.
Only single-segment buffer objects are accepted; :exc:`TypeError` is raised
for all others.
This format accepts any object which implements the read-write buffer
interface. It fills a :ctype:`Py_buffer` structure provided by the caller.
The buffer may contain embedded null bytes. The caller have to call
:cfunc:`PyBuffer_Release` when it is done with the buffer.
``es`` (:class:`str`) [const char \*encoding, char \*\*buffer]
This variant on ``s`` is used for encoding Unicode into a character buffer.