diff options
author | Antoine Pitrou <solipsis@pitrou.net> | 2011-12-18 00:26:05 (GMT) |
---|---|---|
committer | Antoine Pitrou <solipsis@pitrou.net> | 2011-12-18 00:26:05 (GMT) |
commit | b511aca596d300af45928e9b9dcbcaaa87bc62df (patch) | |
tree | 2a291f07f395c1022e1a46475721ff0baac37683 /Doc/c-api | |
parent | f8eac00779c4a3c66a85a3737f0977bb54305e05 (diff) | |
parent | 07b1c877b2d07d39405184cde7d60ccf048e6d1d (diff) | |
download | cpython-b511aca596d300af45928e9b9dcbcaaa87bc62df.zip cpython-b511aca596d300af45928e9b9dcbcaaa87bc62df.tar.gz cpython-b511aca596d300af45928e9b9dcbcaaa87bc62df.tar.bz2 |
Issue #13522: document error return values of some float and complex C API functions.
Diffstat (limited to 'Doc/c-api')
-rw-r--r-- | Doc/c-api/complex.rst | 8 | ||||
-rw-r--r-- | Doc/c-api/float.rst | 2 |
2 files changed, 9 insertions, 1 deletions
diff --git a/Doc/c-api/complex.rst b/Doc/c-api/complex.rst index 43dfe56..3cff88a 100644 --- a/Doc/c-api/complex.rst +++ b/Doc/c-api/complex.rst @@ -63,12 +63,18 @@ pointers. This is consistent throughout the API. Return the quotient of two complex numbers, using the C :c:type:`Py_complex` representation. + If *divisor* is null, this method returns zero and sets + :c:data:`errno` to :c:data:`EDOM`. + .. c:function:: Py_complex _Py_c_pow(Py_complex num, Py_complex exp) Return the exponentiation of *num* by *exp*, using the C :c:type:`Py_complex` representation. + If :attr:`exp.imag` is not null, or :attr:`exp.real` is negative, + this method returns zero and sets :c:data:`errno` to :c:data:`EDOM`. + Complex Numbers as Python Objects ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -123,4 +129,4 @@ Complex Numbers as Python Objects If *op* is not a Python complex number object but has a :meth:`__complex__` method, this method will first be called to convert *op* to a Python complex - number object. + number object. Upon failure, this method returns ``-1.0`` as a real value. diff --git a/Doc/c-api/float.rst b/Doc/c-api/float.rst index 757efd3..27a75e3 100644 --- a/Doc/c-api/float.rst +++ b/Doc/c-api/float.rst @@ -47,6 +47,8 @@ Floating Point Objects Return a C :c:type:`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 + :c:func:`PyErr_Occurred` to check for errors. .. c:function:: double PyFloat_AS_DOUBLE(PyObject *pyfloat) |