summaryrefslogtreecommitdiffstats
path: root/Doc
diff options
context:
space:
mode:
authorMarc-André Lemburg <mal@egenix.com>2001-01-17 17:09:53 (GMT)
committerMarc-André Lemburg <mal@egenix.com>2001-01-17 17:09:53 (GMT)
commitad7c98e264bbc9c84e911417c8770f6e95ffb794 (patch)
tree7586edae78b019c6c2db46861da762083e0c3c8a /Doc
parentd5c43065d5aa7bd8b9ec67525bd01d2c09a7759f (diff)
downloadcpython-ad7c98e264bbc9c84e911417c8770f6e95ffb794.zip
cpython-ad7c98e264bbc9c84e911417c8770f6e95ffb794.tar.gz
cpython-ad7c98e264bbc9c84e911417c8770f6e95ffb794.tar.bz2
This patch adds a new builtin unistr() which behaves like str()
except that it always returns Unicode objects. A new C API PyObject_Unicode() is also provided. This closes patch #101664. Written by Marc-Andre Lemburg. Copyright assigned to Guido van Rossum.
Diffstat (limited to 'Doc')
-rw-r--r--Doc/api/api.tex20
-rw-r--r--Doc/lib/libfuncs.tex6
2 files changed, 20 insertions, 6 deletions
diff --git a/Doc/api/api.tex b/Doc/api/api.tex
index e81edab..da26364 100644
--- a/Doc/api/api.tex
+++ b/Doc/api/api.tex
@@ -4,7 +4,7 @@
\input{boilerplate}
-\makeindex % tell \index to actually write the .idx file
+\makeindex % tell \index to actually write the .idx file
\begin{document}
@@ -1476,6 +1476,14 @@ by the \keyword{print} statement.
\end{cfuncdesc}
+\begin{cfuncdesc}{PyObject*}{PyObject_Unicode}{PyObject *o}
+Compute a Unicode string representation of object \var{o}. Returns the
+Unicode string representation on success, \NULL{} on failure. This is
+the equivalent of the Python expression \samp{unistr(\var{o})}.
+Called by the \function{unistr()}\bifuncindex{unistr} built-in function.
+\end{cfuncdesc}
+
+
\begin{cfuncdesc}{int}{PyCallable_Check}{PyObject *o}
Determine if the object \var{o} is callable. Return \code{1} if the
object is callable and \code{0} otherwise.
@@ -3780,14 +3788,14 @@ Returns true if its argument is a \ctype{PyCObject}.
\end{cfuncdesc}
\begin{cfuncdesc}{PyObject*}{PyCObject_FromVoidPtr}{void* cobj,
- void (*destr)(void *)}
+ void (*destr)(void *)}
Creates a \ctype{PyCObject} from the \code{void *}\var{cobj}. The
\var{destr} function will be called when the object is reclaimed, unless
it is \NULL.
\end{cfuncdesc}
\begin{cfuncdesc}{PyObject*}{PyCObject_FromVoidPtrAndDesc}{void* cobj,
- void* desc, void (*destr)(void *, void *) }
+ void* desc, void (*destr)(void *, void *) }
Creates a \ctype{PyCObject} from the \ctype{void *}\var{cobj}. The
\var{destr} function will be called when the object is reclaimed. The
\var{desc} argument can be used to pass extra callback data for the
@@ -4661,11 +4669,11 @@ implementing new object types in C.
\end{cfuncdesc}
\begin{cfuncdesc}{PyObject*}{PyObject_Init}{PyObject *op,
- PyTypeObject *type}
+ PyTypeObject *type}
\end{cfuncdesc}
\begin{cfuncdesc}{PyVarObject*}{PyObject_InitVar}{PyVarObject *op,
- PyTypeObject *type, int size}
+ PyTypeObject *type, int size}
\end{cfuncdesc}
\begin{cfuncdesc}{\var{TYPE}*}{PyObject_New}{TYPE, PyTypeObject *type}
@@ -4909,6 +4917,6 @@ The function cannot fail.
\chapter{Reporting Bugs}
\input{reportingbugs}
-\input{api.ind} % Index -- must be last
+\input{api.ind} % Index -- must be last
\end{document}
diff --git a/Doc/lib/libfuncs.tex b/Doc/lib/libfuncs.tex
index 2f8dcf9..6b8d64c 100644
--- a/Doc/lib/libfuncs.tex
+++ b/Doc/lib/libfuncs.tex
@@ -694,6 +694,12 @@ to decode UTF-8 in strict mode, meaning that encoding errors raise
\versionadded{2.0}
\end{funcdesc}
+\begin{funcdesc}{unistr}{object}
+Return a Unicode string containing a nicely printable representation of an
+object. For Unicode, this returns the Unicode string itself. For
+all other objects, it tries to convert \code{str(\var{object})] to Unicode.
+\end{funcdesc}
+
\begin{funcdesc}{vars}{\optional{object}}
Without arguments, return a dictionary corresponding to the current
local symbol table. With a module, class or class instance object as