[Python-checkins] CVS: python/dist/src/Doc/api api.tex,1.87,1.88

M.-A. Lemburg python-dev@python.org
Tue, 19 Sep 2000 14:04:04 -0700


Update of /cvsroot/python/python/dist/src/Doc/api
In directory slayer.i.sourceforge.net:/tmp/cvs-serv20055/Doc/api

Modified Files:
	api.tex 
Log Message:
This patch adds a new Python C API called PyString_AsStringAndSize()
which implements the automatic conversion from Unicode to a string
object using the default encoding.

The new API is then put to use to have eval() and exec accept
Unicode objects as code parameter. This closes bugs #110924
and #113890.

As side-effect, the traditional C APIs PyString_Size() and
PyString_AsString() will also accept Unicode objects as
parameters.

Index: api.tex
===================================================================
RCS file: /cvsroot/python/python/dist/src/Doc/api/api.tex,v
retrieving revision 1.87
retrieving revision 1.88
diff -C2 -r1.87 -r1.88
*** api.tex	2000/09/16 16:30:48	1.87
--- api.tex	2000/09/19 21:04:00	1.88
***************
*** 2106,2109 ****
--- 2106,2126 ----
  \end{cfuncdesc}
  
+ \begin{cfuncdesc}{int}{PyString_AsStringAndSize}{PyObject *obj,
+                                                  char **buffer,
+                                                  int *length}
+ Returns a null-terminated representation of the contents of the object
+ \var{obj} through the output variables \var{buffer} and \var{length}.
+ 
+ The function accepts both string and Unicode objects as input. For
+ Unicode objects it returns the default encoded version of the object.
+ If \var{length} is set to \NULL{}, the resulting buffer may not contain
+ null characters; if it does, the function returns -1 and a
+ TypeError is raised.
+ 
+ The buffer refers to an internal string buffer of \var{obj}, not a
+ copy. The data must not be modified in any way.  It must not be
+ de-allocated.
+ \end{cfuncdesc}
+ 
  \begin{cfuncdesc}{void}{PyString_Concat}{PyObject **string,
                                           PyObject *newpart}