diff options
author | Fred Drake <fdrake@acm.org> | 2000-05-03 15:17:02 (GMT) |
---|---|---|
committer | Fred Drake <fdrake@acm.org> | 2000-05-03 15:17:02 (GMT) |
commit | 25871c001f55941fec83e7ce9832e5f45c69a8cf (patch) | |
tree | 82d9108087ec195c76712a9e1fa87de0223c7970 /Doc | |
parent | ae08853fb0c77067baa2b8bdc28f4e74df4f9f68 (diff) | |
download | cpython-25871c001f55941fec83e7ce9832e5f45c69a8cf.zip cpython-25871c001f55941fec83e7ce9832e5f45c69a8cf.tar.gz cpython-25871c001f55941fec83e7ce9832e5f45c69a8cf.tar.bz2 |
Brian Hooper <brian_takashi@hotmail.com>:
Added 'u' and 'u#' tags for PyArg_ParseTuple - these turn a
PyUnicodeObject argument into a Py_UNICODE * buffer, or a Py_UNICODE *
buffer plus a length with the '#'. Also added an analog to 'U'
for Py_BuildValue.
Diffstat (limited to 'Doc')
-rw-r--r-- | Doc/ext/ext.tex | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/Doc/ext/ext.tex b/Doc/ext/ext.tex index cf5b1ef..e4a42a8 100644 --- a/Doc/ext/ext.tex +++ b/Doc/ext/ext.tex @@ -691,6 +691,17 @@ case the C pointer is set to \NULL{}. \item[\samp{z\#} (string or \code{None}) {[char *, int]}] This is to \samp{s\#} as \samp{z} is to \samp{s}. +\item[\samp{u} (Unicode string) {[Py_UNICODE *]}] +Convert a Python Unicode object to a C pointer to a null-terminated +buffer of Unicode (UCS-2) data. As with \samp{s}, there is no need +to provide storage for the Unicode data buffer; a pointer to the +existing Unicode data is stored into the Py_UNICODE pointer variable whose +address you pass. + +\item[\samp{u\#} (Unicode string) {[Py_UNICODE *, int]}] +This variant on \samp{u} stores into two C variables, the first one +a pointer to a Unicode data buffer, the second one its length. + \item[\samp{b} (integer) {[char]}] Convert a Python integer to a tiny int, stored in a C \ctype{char}. @@ -751,6 +762,11 @@ Like \samp{O} but requires that the Python object is a string object. Raises \exception{TypeError} if the object is not a string object. The C variable may also be declared as \ctype{PyObject *}. +\item[\samp{U} (Unicode string) {[PyUnicodeObject *]}] +Like \samp{O} but requires that the Python object is a Unicode object. +Raises \exception{TypeError} if the object is not a Unicode object. +The C variable may also be declared as \ctype{PyObject *}. + \item[\samp{t\#} (read-only character buffer) {[char *, int]}] Like \samp{s\#}, but accepts any object which implements the read-only buffer interface. The \ctype{char *} variable is set to point to the @@ -1016,6 +1032,15 @@ Convert a Unicode (UCS-2) data buffer and its length to a Python Unicode object. If the Unicode buffer pointer is \NULL, the length is ignored and \code{None} is returned. +\item[\samp{u} (Unicode string) {[Py_UNICODE *]}] +Convert a null-terminated buffer of Unicode (UCS-2) data to a Python Unicode +object. If the Unicode buffer pointer is \NULL{}, \code{None} is returned. + +\item[\samp{u\#} (Unicode string) {[Py_UNICODE *, int]}] +Convert a Unicode (UCS-2) data buffer and its length to a Python Unicode +object. If the Unicode buffer 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. @@ -1050,6 +1075,9 @@ exception. If no exception has been raised yet, \item[\samp{S} (object) {[PyObject *]}] Same as \samp{O}. +\item[\samp{U} (object) {[PyObject *]}] +Same as \samp{O}. + \item[\samp{N} (object) {[PyObject *]}] Same as \samp{O}, except it doesn't increment the reference count on the object. Useful when the object is created by a call to an object |