summaryrefslogtreecommitdiffstats
path: root/Doc/c-api/utilities.rst
diff options
context:
space:
mode:
authorGuido van Rossum <guido@python.org>2007-08-29 18:38:11 (GMT)
committerGuido van Rossum <guido@python.org>2007-08-29 18:38:11 (GMT)
commitfb67be2f6b12e6ab07c17ece1caaf0057d610252 (patch)
tree1cc5f5a63ff45d5dd716a502432ed0db15c5596b /Doc/c-api/utilities.rst
parente86254e2560250ce958330433488ba092ca8ffea (diff)
downloadcpython-fb67be2f6b12e6ab07c17ece1caaf0057d610252.zip
cpython-fb67be2f6b12e6ab07c17ece1caaf0057d610252.tar.gz
cpython-fb67be2f6b12e6ab07c17ece1caaf0057d610252.tar.bz2
Three patches from issue #1047, by Amaury Forgeot d'Arc:
1/ getargs.diff adds the 'Z' and 'Z#' format specifiers for PyArg_ParseTuple. They mimic z and z# for unicode strings, by accepting a Unicode or None (in which case the Py_UNICODE* pointer is set to NULL). With doc and tests. 2/ subprocess.diff converts file PC/_subprocess.c to unicode. We use the Unicode version of the win32 api (and Z conversion from previous patch) 3/ stdout.diff: sys.stdout must not convert the line endings, Windows already does it. Without this patch, when redirecting the output of python, the file contains \r\r\n for each line. (test_subprocess did catch this) However, I (GvR) removed the change to _fileio.c (included in the patches) that prevents closing file descripors < 3 from being closed; I think that needs to be solved in a different way.
Diffstat (limited to 'Doc/c-api/utilities.rst')
-rw-r--r--Doc/c-api/utilities.rst7
1 files changed, 7 insertions, 0 deletions
diff --git a/Doc/c-api/utilities.rst b/Doc/c-api/utilities.rst
index 01c1ceb..8999316 100644
--- a/Doc/c-api/utilities.rst
+++ b/Doc/c-api/utilities.rst
@@ -484,6 +484,13 @@ variable(s) whose address should be passed.
by interpreting their read-buffer pointer as pointer to a :ctype:`Py_UNICODE`
array.
+``Z`` (Unicode or ``None``) [Py_UNICODE \*]
+ Like ``s``, but the Python object may also be ``None``, in which case the C
+ pointer is set to *NULL*.
+
+``Z#`` (Unicode or ``None``) [Py_UNICODE \*, int]
+ This is to ``u#`` as ``Z`` is to ``u``.
+
``es`` (string, Unicode object 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