@@ -1747,35 +1747,39 @@ always available.
1747
1747
1748
1748
The *unraisable * argument has the following attributes:
1749
1749
1750
- * * exc_type * : Exception type.
1751
- * * exc_value * : Exception value, can be ``None ``.
1752
- * * exc_traceback * : Exception traceback, can be ``None ``.
1753
- * * err_msg * : Error message, can be ``None ``.
1754
- * * object * : Object causing the exception, can be ``None ``.
1750
+ * :attr: ` ! exc_type` : Exception type.
1751
+ * :attr: ` ! exc_value` : Exception value, can be ``None ``.
1752
+ * :attr: ` ! exc_traceback` : Exception traceback, can be ``None ``.
1753
+ * :attr: ` ! err_msg` : Error message, can be ``None ``.
1754
+ * :attr: ` ! object` : Object causing the exception, can be ``None ``.
1755
1755
1756
- The default hook formats * err_msg * and * object * as:
1756
+ The default hook formats :attr: ` ! err_msg` and :attr: ` ! object` as:
1757
1757
``f'{err_msg}: {object!r}' ``; use "Exception ignored in" error message
1758
- if * err_msg * is ``None ``.
1758
+ if :attr: ` ! err_msg` is ``None ``.
1759
1759
1760
1760
:func: `sys.unraisablehook ` can be overridden to control how unraisable
1761
1761
exceptions are handled.
1762
1762
1763
- Storing *exc_value * using a custom hook can create a reference cycle. It
1764
- should be cleared explicitly to break the reference cycle when the
1765
- exception is no longer needed.
1763
+ .. seealso ::
1764
+
1765
+ :func: `excepthook ` which handles uncaught exceptions.
1766
+
1767
+ .. warning ::
1766
1768
1767
- Storing * object * using a custom hook can resurrect it if it is set to an
1768
- object which is being finalized. Avoid storing * object * after the custom
1769
- hook completes to avoid resurrecting objects .
1769
+ Storing :attr: ` !exc_value ` using a custom hook can create a reference cycle.
1770
+ It should be cleared explicitly to break the reference cycle when the
1771
+ exception is no longer needed .
1770
1772
1771
- See also :func: `excepthook ` which handles uncaught exceptions.
1773
+ Storing :attr: `!object ` using a custom hook can resurrect it if it is set to an
1774
+ object which is being finalized. Avoid storing :attr: `!object ` after the custom
1775
+ hook completes to avoid resurrecting objects.
1772
1776
1773
1777
.. audit-event :: sys.unraisablehook hook,unraisable sys.unraisablehook
1774
1778
1775
1779
Raise an auditing event ``sys.unraisablehook `` with arguments
1776
- `` hook ``, `` unraisable `` when an exception that cannot be handled occurs.
1777
- The `` unraisable `` object is the same as what will be passed to the hook.
1778
- If no hook has been set, `` hook `` may be ``None ``.
1780
+ * hook *, * unraisable * when an exception that cannot be handled occurs.
1781
+ The * unraisable * object is the same as what will be passed to the hook.
1782
+ If no hook has been set, * hook * may be ``None ``.
1779
1783
1780
1784
.. versionadded :: 3.8
1781
1785
0 commit comments