Skip to content

Commit 939a1f6

Browse files
committed
remove __note__ documentation
1 parent a964a2d commit 939a1f6

2 files changed

Lines changed: 0 additions & 70 deletions

File tree

‎Doc/library/traceback.rst‎

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -236,14 +236,6 @@ capture data for later printing in a lightweight fashion.
236236

237237
The ``__suppress_context__`` value from the original exception.
238238

239-
.. attribute:: __note__
240-
241-
The ``__note__`` value from the original exception, which is
242-
string or ``None``. If it is not ``None`` is it formatted in
243-
the traceback after the exception string.
244-
245-
.. versionadded:: 3.11
246-
247239
.. attribute:: stack
248240

249241
A :class:`StackSummary` representing the traceback.

‎Doc/tutorial/errors.rst‎

Lines changed: 0 additions & 62 deletions
Original file line numberDiff line numberDiff line change
@@ -585,65 +585,3 @@ the following pattern::
585585
... raise ExceptionGroup("Test Failures", excs)
586586
...
587587

588-
589-
Enriching Exceptions with Notes
590-
===============================
591-
592-
When an exception is created in order to be raised, it is usually initialized
593-
with information that describes the error that has occurred. There are cases
594-
where it is useful to add information after the exception was caught. For this
595-
purpose, exceptions have a mutable field ``__note__`` that can be string or
596-
``None`` (``None`` by default). If it is a string, it is included in the
597-
formatted tracebacks after the exception. ::
598-
599-
>>> try:
600-
... raise TypeError('bad type')
601-
... except Exception as e:
602-
... e.__note__ = 'Add some information'
603-
... raise
604-
...
605-
Traceback (most recent call last):
606-
File "<stdin>", line 2, in <module>
607-
TypeError: bad type
608-
Add some information
609-
>>>
610-
611-
For example, when collecting exceptions into an exception group, we may want
612-
to add context information for the individual errors. In the following each
613-
exception in the group has a note indicating when this error has occurred. ::
614-
615-
>>> def f():
616-
... raise OSError('operation failed')
617-
...
618-
>>> excs = []
619-
>>> for i in range(3):
620-
... try:
621-
... f()
622-
... except Exception as e:
623-
... e.__note__ = f'Happened in Iteration {i+1}'
624-
... excs.append(e)
625-
...
626-
>>> raise ExceptionGroup('We have some problems', excs)
627-
+ Exception Group Traceback (most recent call last):
628-
| File "<stdin>", line 1, in <module>
629-
| ExceptionGroup: We have some problems
630-
+-+---------------- 1 ----------------
631-
| Traceback (most recent call last):
632-
| File "<stdin>", line 3, in <module>
633-
| File "<stdin>", line 2, in f
634-
| OSError: operation failed
635-
| Happened in Iteration 1
636-
+---------------- 2 ----------------
637-
| Traceback (most recent call last):
638-
| File "<stdin>", line 3, in <module>
639-
| File "<stdin>", line 2, in f
640-
| OSError: operation failed
641-
| Happened in Iteration 2
642-
+---------------- 3 ----------------
643-
| Traceback (most recent call last):
644-
| File "<stdin>", line 3, in <module>
645-
| File "<stdin>", line 2, in f
646-
| OSError: operation failed
647-
| Happened in Iteration 3
648-
+------------------------------------
649-
>>>

0 commit comments

Comments
 (0)