mirror of
https://github.com/python/cpython.git
synced 2025-08-02 08:02:56 +00:00
#10058: tweak wording about exception returns.
This commit is contained in:
parent
17ef0d51d7
commit
dd909db1a9
1 changed files with 10 additions and 9 deletions
|
@ -361,15 +361,16 @@ traceback.
|
||||||
|
|
||||||
.. index:: single: PyErr_Occurred()
|
.. index:: single: PyErr_Occurred()
|
||||||
|
|
||||||
For C programmers, however, error checking always has to be explicit. All
|
For C programmers, however, error checking always has to be explicit. All
|
||||||
functions in the Python/C API can raise exceptions, unless an explicit claim is
|
functions in the Python/C API can raise exceptions, unless an explicit claim is
|
||||||
made otherwise in a function's documentation. In general, when a function
|
made otherwise in a function's documentation. In general, when a function
|
||||||
encounters an error, it sets an exception, discards any object references that
|
encounters an error, it sets an exception, discards any object references that
|
||||||
it owns, and returns an error indicator --- usually *NULL* or ``-1``. A few
|
it owns, and returns an error indicator. If not documented otherwise, this
|
||||||
functions return a Boolean true/false result, with false indicating an error.
|
indicator is either *NULL* or ``-1``, depending on the function's return type.
|
||||||
Very few functions return no explicit error indicator or have an ambiguous
|
A few functions return a Boolean true/false result, with false indicating an
|
||||||
return value, and require explicit testing for errors with
|
error. Very few functions return no explicit error indicator or have an
|
||||||
:c:func:`PyErr_Occurred`.
|
ambiguous return value, and require explicit testing for errors with
|
||||||
|
:c:func:`PyErr_Occurred`. These exceptions are always explicitly documented.
|
||||||
|
|
||||||
.. index::
|
.. index::
|
||||||
single: PyErr_SetString()
|
single: PyErr_SetString()
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue