bpo-45607: Make it possible to enrich exception displays via setting their __note__ field (GH-29880)

This commit is contained in:
Irit Katriel 2021-12-03 22:01:15 +00:00 committed by GitHub
parent d9301703fb
commit 5bb7ef2768
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
10 changed files with 183 additions and 5 deletions

View file

@ -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