Skip to content
Merged
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions pep-0678.rst
Original file line number Diff line number Diff line change
Expand Up @@ -140,10 +140,10 @@ are collecting multiple exception objects to handle together. [1]_
Specification
=============

``BaseException`` gains a new read-only attribute ``__notes__``, an initially
empty tuple, and a new method ``.add_note(note: str)``. ``note`` is added to
the exception's notes, which appear in the standard traceback after the
exception string. A ``TypeError`` is raised if ``note`` is not a string.
``BaseException`` gains a new new method ``.add_note(note: str)``. Notes are
exposed as a tuple via the read-only attribute ``__notes__``, and appear in
the standard traceback after the exception string. ``.add_note()`` raises
``TypeError`` if ``note`` is not a string.
Comment thread
Zac-HD marked this conversation as resolved.
Outdated

``del err.__notes__`` clears the contents of the ``__notes__`` attribute,
leaving it an empty tuple as if ``.add_note()`` had never been called. This
Expand Down Expand Up @@ -319,8 +319,8 @@ proposed ``__notes__`` semantics, but this would be rarely and inconsistently
applicable.


Store notes in ``ExceptionGroup``\ s
------------------------------------
Store notes in ``ExceptionGroup``\ s, but not other ``Exception``\ s
Comment thread
Zac-HD marked this conversation as resolved.
Outdated
--------------------------------------------------------------------
Initial discussions proposed making a more focussed change by thinking about
how to associate messages with the nested exceptions in ``ExceptionGroup`` s,
such as a list of notes or mapping of exceptions to notes. However, this would
Expand Down