mirror of
https://github.com/python/cpython.git
synced 2025-08-14 22:01:08 +00:00
merge in r67362 documentation update to document PY_SSIZE_T_CLEAN
This commit is contained in:
parent
b8babfb696
commit
d8ab1e4751
1 changed files with 6 additions and 1 deletions
|
@ -32,7 +32,7 @@ variable(s) whose address should be passed.
|
||||||
converted to C strings using the default encoding. If this conversion fails, a
|
converted to C strings using the default encoding. If this conversion fails, a
|
||||||
:exc:`UnicodeError` is raised.
|
:exc:`UnicodeError` is raised.
|
||||||
|
|
||||||
``s#`` (string, Unicode or any read buffer compatible object) [const char \*, int]
|
``s#`` (string, Unicode or any read buffer compatible object) [const char \*, int (or :ctype:`Py_ssize_t`, see below)]
|
||||||
This variant on ``s`` stores into two C variables, the first one a pointer to a
|
This variant on ``s`` stores into two C variables, the first one a pointer to a
|
||||||
character string, the second one its length. In this case the Python string may
|
character string, the second one its length. In this case the Python string may
|
||||||
contain embedded null bytes. Unicode objects pass back a pointer to the default
|
contain embedded null bytes. Unicode objects pass back a pointer to the default
|
||||||
|
@ -40,6 +40,11 @@ variable(s) whose address should be passed.
|
||||||
other read-buffer compatible objects pass back a reference to the raw internal
|
other read-buffer compatible objects pass back a reference to the raw internal
|
||||||
data representation.
|
data representation.
|
||||||
|
|
||||||
|
Starting with Python 2.5 the type of the length argument can be
|
||||||
|
controlled by defining the macro :cmacro:`PY_SSIZE_T_CLEAN` before
|
||||||
|
including :file:`Python.h`. If the macro is defined, length is a
|
||||||
|
:ctype:`Py_ssize_t` rather than an int.
|
||||||
|
|
||||||
``s*`` (string, Unicode, or any buffer compatible object) [Py_buffer \*]
|
``s*`` (string, Unicode, or any buffer compatible object) [Py_buffer \*]
|
||||||
Similar to ``s#``, this code fills a Py_buffer structure provided by the caller.
|
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
|
The buffer gets locked, so that the caller can subsequently use the buffer even
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue