summaryrefslogtreecommitdiffstats
path: root/Doc
diff options
context:
space:
mode:
authorGuido van Rossum <guido@python.org>1996-09-10 17:36:17 (GMT)
committerGuido van Rossum <guido@python.org>1996-09-10 17:36:17 (GMT)
commitc05797dd1506d1f5d6d9a3a57becf91baf1e4801 (patch)
tree839627cac3d8d5620b50147efed9332c1d8b2c62 /Doc
parente6ad8913e20766e3769b346450dc952f0140462c (diff)
downloadcpython-c05797dd1506d1f5d6d9a3a57becf91baf1e4801.zip
cpython-c05797dd1506d1f5d6d9a3a57becf91baf1e4801.tar.gz
cpython-c05797dd1506d1f5d6d9a3a57becf91baf1e4801.tar.bz2
Fixed coerce docs
Diffstat (limited to 'Doc')
-rw-r--r--Doc/extref.tex16
1 files changed, 12 insertions, 4 deletions
diff --git a/Doc/extref.tex b/Doc/extref.tex
index c88976c..75485c6 100644
--- a/Doc/extref.tex
+++ b/Doc/extref.tex
@@ -356,10 +356,18 @@ From the viewpoint of of C access to Python services, we have:
\begin{cfuncdesc}{PyObject*}{PyNumber_Coerce}{PyObject *o1, PyObject *o2}
- On success, returns a tuple containing \code{o1} and \code{o2} converted to
- a common numeric type, or None if no conversion is possible.
- Returns -1 on failure. This is equivalent to the Python
- expression: \code{coerce(o1,o2)}.
+ This function takes the addresses of two variables of type
+ \code{PyObject*}.
+
+ If the objects pointed to by \code{*p1} and \code{*p2} have the same type,
+ increment their reference count and return 0 (success).
+ If the objects can be converted to a common numeric type,
+ replace \code{*p1} and \code{*p2} by their converted value (with 'new'
+ reference counts), and return 0.
+ If no conversion is possible, or if some other error occurs,
+ return -1 (failure) and don't increment the reference counts.
+ The call \code{PyNumber_Coerce(&o1, &o2)} is equivalent to the Python
+ statement \code{o1, o2 = coerce(o1, o2)}.
\end{cfuncdesc}