]> granicus.if.org Git - python/commitdiff
Issue #13522: document error return values of some float and complex C API functions.
authorAntoine Pitrou <solipsis@pitrou.net>
Sun, 18 Dec 2011 00:25:27 +0000 (01:25 +0100)
committerAntoine Pitrou <solipsis@pitrou.net>
Sun, 18 Dec 2011 00:25:27 +0000 (01:25 +0100)
Doc/c-api/complex.rst
Doc/c-api/float.rst
Misc/ACKS

index 364ab7895717ef31f7f6199bf84c54311bf0306e..f5304bdb227e77ba5aefb5501b5dc5faa2b0116e 100644 (file)
@@ -63,12 +63,18 @@ pointers.  This is consistent throughout the API.
    Return the quotient of two complex numbers, using the C :ctype:`Py_complex`
    representation.
 
+   If *divisor* is null, this method returns zero and sets
+   :cdata:`errno` to :cdata:`EDOM`.
+
 
 .. cfunction:: Py_complex _Py_c_pow(Py_complex num, Py_complex exp)
 
    Return the exponentiation of *num* by *exp*, using the C :ctype:`Py_complex`
    representation.
 
+   If :attr:`exp.imag` is not null, or :attr:`exp.real` is negative,
+   this method returns zero and sets :cdata:`errno` to :cdata:`EDOM`.
+
 
 Complex Numbers as Python Objects
 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
@@ -125,6 +131,7 @@ Complex Numbers as Python Objects
 .. cfunction:: Py_complex PyComplex_AsCComplex(PyObject *op)
 
    Return the :ctype:`Py_complex` value of the complex number *op*.
+   Upon failure, this method returns ``-1.0`` as a real value.
 
    .. versionchanged:: 2.6
       If *op* is not a Python complex number object but has a :meth:`__complex__`
index 295fb90d05d808130052ec351bf4bd66d0254b04..d92f155dd029b04930c18788f771d9313110a1f5 100644 (file)
@@ -55,6 +55,8 @@ Floating Point Objects
    Return a C :ctype:`double` representation of the contents of *pyfloat*.  If
    *pyfloat* is not a Python floating point object but has a :meth:`__float__`
    method, this method will first be called to convert *pyfloat* into a float.
+   This method returns ``-1.0`` upon failure, so one should call
+   :cfunc:`PyErr_Occurred` to check for errors.
 
 
 .. cfunction:: double PyFloat_AS_DOUBLE(PyObject *pyfloat)
index 44e92c1516d44572a3b93795ca3d09294f8dd924..8c8b9b8022f6f9be12c82b9d48c3df2968667e64 100644 (file)
--- a/Misc/ACKS
+++ b/Misc/ACKS
@@ -120,6 +120,7 @@ Tarn Weisner Burton
 Lee Busby
 Ralph Butler
 Jp Calderone
+Arnaud Calmettes
 Daniel Calvelo
 Tony Campbell
 Brett Cannon