summaryrefslogtreecommitdiffstats
path: root/Doc/api
diff options
context:
space:
mode:
authorWalter Dörwald <walter@livinglogic.de>2007-05-18 16:29:38 (GMT)
committerWalter Dörwald <walter@livinglogic.de>2007-05-18 16:29:38 (GMT)
commitd2034310d66b9d387b252972852537c0b592f141 (patch)
tree77d03818fd4896b2dc1ea3eb87202bf1d82d8866 /Doc/api
parent5550731d9cf5bca2379b15d5238ee5a39ebc6ce3 (diff)
downloadcpython-d2034310d66b9d387b252972852537c0b592f141.zip
cpython-d2034310d66b9d387b252972852537c0b592f141.tar.gz
cpython-d2034310d66b9d387b252972852537c0b592f141.tar.bz2
Add 'U'/'U#' format characters to Py_BuildValue (and thus
to PyObject_CallFunction()) that take a char * (and a size in the case of 'U#') and create a unicode object out of it. Add functions PyUnicode_FromFormat() and PyUnicode_FromFormatV() that work similar to PyString_FromFormat(), but create a unicode object (also a %U format character has been added, that takes a PyObject *, which must point to a unicode object). Change the encoding and reason attributes of UnicodeEncodeError, UnicodeDecodeError and UnicodeTranslateError to be unicode objects.
Diffstat (limited to 'Doc/api')
-rw-r--r--Doc/api/utilities.tex9
1 files changed, 9 insertions, 0 deletions
diff --git a/Doc/api/utilities.tex b/Doc/api/utilities.tex
index fb9c909..968ce4f 100644
--- a/Doc/api/utilities.tex
+++ b/Doc/api/utilities.tex
@@ -848,6 +848,15 @@ PyArg_ParseTuple(args, "O|O:ref", &object, &callback)
to a Python Unicode object. If the Unicode buffer pointer
is \NULL, the length is ignored and \code{None} is returned.
+ \item[\samp{U} (string) {[char *]}]
+ Convert a null-terminated C string to a Python unicode object.
+ If the C string pointer is \NULL, \code{None} is used.
+
+ \item[\samp{U\#} (string) {[char *, int]}]
+ Convert a C string and its length to a Python unicode object.
+ If the C string pointer is \NULL, the length is ignored and \code{None}
+ is returned.
+
\item[\samp{i} (integer) {[int]}]
Convert a plain C \ctype{int} to a Python integer object.