summaryrefslogtreecommitdiffstats
path: root/Doc/c-api
diff options
context:
space:
mode:
authorGregory P. Smith <greg@mad-scientist.com>2008-11-24 00:41:43 (GMT)
committerGregory P. Smith <greg@mad-scientist.com>2008-11-24 00:41:43 (GMT)
commitb07bd10c91087b596906e582fcbb5ac36dd722ed (patch)
treefe8d0e1a1e86a4f73b80bf3fe83a25b3a9bc168d /Doc/c-api
parent0b9999c0792dcfe6f7c231ff410c22f1483080e9 (diff)
downloadcpython-b07bd10c91087b596906e582fcbb5ac36dd722ed.zip
cpython-b07bd10c91087b596906e582fcbb5ac36dd722ed.tar.gz
cpython-b07bd10c91087b596906e582fcbb5ac36dd722ed.tar.bz2
Document PY_SSIZE_T_CLEAN for PyArg_ParseTuple.
Diffstat (limited to 'Doc/c-api')
-rw-r--r--Doc/c-api/arg.rst7
1 files changed, 6 insertions, 1 deletions
diff --git a/Doc/c-api/arg.rst b/Doc/c-api/arg.rst
index 1ea9e9a..2525438 100644
--- a/Doc/c-api/arg.rst
+++ b/Doc/c-api/arg.rst
@@ -32,7 +32,7 @@ variable(s) whose address should be passed.
converted to C strings using the default encoding. If this conversion fails, a
: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
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
@@ -40,6 +40,11 @@ variable(s) whose address should be passed.
other read-buffer compatible objects pass back a reference to the raw internal
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 \*]
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