mirror of
https://github.com/python/cpython.git
synced 2025-08-04 08:59:19 +00:00
bpo-45607: Make it possible to enrich exception displays via setting their __note__ field (GH-29880)
This commit is contained in:
parent
d9301703fb
commit
5bb7ef2768
10 changed files with 183 additions and 5 deletions
|
@ -127,6 +127,14 @@ The following exceptions are used mostly as base classes for other exceptions.
|
|||
tb = sys.exc_info()[2]
|
||||
raise OtherException(...).with_traceback(tb)
|
||||
|
||||
.. attribute:: __note__
|
||||
|
||||
A mutable field which is :const:`None` by default and can be set to a string.
|
||||
If it is not :const:`None`, it is included in the traceback. This field can
|
||||
be used to enrich exceptions after they have been caught.
|
||||
|
||||
.. versionadded:: 3.11
|
||||
|
||||
|
||||
.. exception:: Exception
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue