diff options
Diffstat (limited to 'Doc')
| -rw-r--r-- | Doc/c-api/exceptions.rst | 8 | ||||
| -rw-r--r-- | Doc/library/exceptions.rst | 23 | ||||
| -rw-r--r-- | Doc/library/stdtypes.rst | 9 |
3 files changed, 16 insertions, 24 deletions
diff --git a/Doc/c-api/exceptions.rst b/Doc/c-api/exceptions.rst index f181143..9a66b7f 100644 --- a/Doc/c-api/exceptions.rst +++ b/Doc/c-api/exceptions.rst @@ -471,10 +471,6 @@ Exception Objects 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) @@ -482,9 +478,7 @@ Exception Objects 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. + :attr:`__suppress_context__` is implicitly set to ``True`` by this function. .. _unicodeexceptions: diff --git a/Doc/library/exceptions.rst b/Doc/library/exceptions.rst index 33bc3b0..faf6732 100644 --- a/Doc/library/exceptions.rst +++ b/Doc/library/exceptions.rst @@ -39,18 +39,17 @@ When raising (or re-raising) an exception in an :keyword:`except` clause new exception is not handled the traceback that is eventually displayed will include the originating exception(s) and the final exception. -This implicit exception chain can be made explicit by using :keyword:`from` -with :keyword:`raise`. The single argument to :keyword:`from` must be an -exception or :const:`None`, and it will be set as :attr:`__cause__` on the -raised exception. If :attr:`__cause__` is an exception it will be displayed -instead of :attr:`__context__`; if :attr:`__cause__` is None, -:attr:`__context__` will not be displayed by the default exception handling -code. (Note: the default value for :attr:`__context__` is :const:`None`, -while the default value for :attr:`__cause__` is :const:`Ellipsis`.) - -In either case, the default exception handling code will not display -any of the remaining links in the :attr:`__context__` chain if -:attr:`__cause__` has been set. +This implicit exception chain can be made explicit by using :keyword:`from` with +:keyword:`raise`. The single argument to :keyword:`from` must be an exception +or ``None``. It will be set as :attr:`__cause__` on the raised exception. +Setting :attr:`__cause__` implicitly sets the :attr:`__suppress_context__` to +``True``. If :attr:`__cause__` is an exception, it will be displayed. If +:attr:`__cause__` is present or :attr:`__suppress_context__` has a true value, +:attr:`__context__` will not be displayed. + +In either case, the default exception handling code will not display any of the +remaining links in the :attr:`__context__` chain if :attr:`__cause__` has been +set. Base classes diff --git a/Doc/library/stdtypes.rst b/Doc/library/stdtypes.rst index a34b1cf..bf86d8eb 100644 --- a/Doc/library/stdtypes.rst +++ b/Doc/library/stdtypes.rst @@ -2996,11 +2996,10 @@ It is written as ``None``. The Ellipsis Object ------------------- -This object is commonly used by slicing (see :ref:`slicings`), but may also -be used in other situations where a sentinel value other than :const:`None` -is needed. It supports no special operations. There is exactly one ellipsis -object, named :const:`Ellipsis` (a built-in name). ``type(Ellipsis)()`` -produces the :const:`Ellipsis` singleton. +This object is commonly used by slicing (see :ref:`slicings`). It supports no +special operations. There is exactly one ellipsis object, named +:const:`Ellipsis` (a built-in name). ``type(Ellipsis)()`` produces the +:const:`Ellipsis` singleton. It is written as ``Ellipsis`` or ``...``. |
