[Python-checkins] CVS: python/dist/src/Doc/ext ext.tex,1.72,1.73

Fred Drake python-dev@python.org
Wed, 3 May 2000 11:17:05 -0400


Update of /projects/cvsroot/python/dist/src/Doc/ext
In directory seahag.cnri.reston.va.us:/home/fdrake/projects/python/Doc/ext

Modified Files:
	ext.tex 
Log Message:

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.


Index: ext.tex
===================================================================
RCS file: /projects/cvsroot/python/dist/src/Doc/ext/ext.tex,v
retrieving revision 1.72
retrieving revision 1.73
diff -C2 -r1.72 -r1.73
*** ext.tex	2000/04/28 14:43:33	1.72
--- ext.tex	2000/05/03 15:17:02	1.73
***************
*** 692,695 ****
--- 692,706 ----
  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}.
***************
*** 752,755 ****
--- 763,771 ----
  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 
***************
*** 1017,1020 ****
--- 1033,1045 ----
  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.
***************
*** 1049,1052 ****
--- 1074,1080 ----
  
  \item[\samp{S} (object) {[PyObject *]}]
+ Same as \samp{O}.
+ 
+ \item[\samp{U} (object) {[PyObject *]}]
  Same as \samp{O}.