diff options
author | Nick Coghlan <ncoghlan@gmail.com> | 2012-02-26 07:49:52 (GMT) |
---|---|---|
committer | Nick Coghlan <ncoghlan@gmail.com> | 2012-02-26 07:49:52 (GMT) |
commit | ab7bf2143e67ddc1510413fa0d7f9c621adf22fa (patch) | |
tree | 62a24ed4f57e4db638ebde745bb83e2e09fc86e3 /Doc/c-api | |
parent | cda6b6d60d96e6f755da92deb5e4066839095791 (diff) | |
download | cpython-ab7bf2143e67ddc1510413fa0d7f9c621adf22fa.zip cpython-ab7bf2143e67ddc1510413fa0d7f9c621adf22fa.tar.gz cpython-ab7bf2143e67ddc1510413fa0d7f9c621adf22fa.tar.bz2 |
Close issue #6210: Implement PEP 409
Diffstat (limited to 'Doc/c-api')
-rw-r--r-- | Doc/c-api/exceptions.rst | 19 |
1 files changed, 13 insertions, 6 deletions
diff --git a/Doc/c-api/exceptions.rst b/Doc/c-api/exceptions.rst index c7252ed..fd7aee7 100644 --- a/Doc/c-api/exceptions.rst +++ b/Doc/c-api/exceptions.rst @@ -421,17 +421,24 @@ Exception Objects .. c:function:: PyObject* PyException_GetCause(PyObject *ex) - Return the cause (another exception instance set by ``raise ... from ...``) - associated with the exception as a new reference, as accessible from Python - through :attr:`__cause__`. If there is no cause associated, this returns - *NULL*. + Return the cause (either an exception instance, or :const:`None`, + set by ``raise ... from ...``) associated with the exception as a new + reference, as accessible from Python through :attr:`__cause__`. + + If there is no cause associated, this returns *NULL* (from Python + ``__cause__ is Ellipsis``). If the cause is :const:`None`, the default + exception display routines stop showing the context chain. .. c:function:: void PyException_SetCause(PyObject *ex, PyObject *ctx) Set the cause associated with the exception to *ctx*. Use *NULL* to clear - it. There is no type check to make sure that *ctx* is an exception instance. - This steals a reference to *ctx*. + it. There is no type check to make sure that *ctx* is either an exception + instance or :const:`None`. This steals a reference to *ctx*. + + If the cause is set to :const:`None` the default exception display + routines will not display this exception's context, and will not follow the + chain any further. .. _unicodeexceptions: |