diff options
author | Victor Stinner <vstinner@redhat.com> | 2019-06-14 16:03:22 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-06-14 16:03:22 (GMT) |
commit | 212646cae6b7c4ddc8d98c8b9b6d39a5f259e864 (patch) | |
tree | bb98370389d304b2b835efd3791fcbbab07bb320 /Doc/library/test.rst | |
parent | 9765efcb39fc03d5b1abec3924388974470a8bd5 (diff) | |
download | cpython-212646cae6b7c4ddc8d98c8b9b6d39a5f259e864.zip cpython-212646cae6b7c4ddc8d98c8b9b6d39a5f259e864.tar.gz cpython-212646cae6b7c4ddc8d98c8b9b6d39a5f259e864.tar.bz2 |
bpo-37261: Document sys.unraisablehook corner cases (GH-14059)
Document reference cycle and resurrected objects issues in
sys.unraisablehook() and threading.excepthook() documentation.
Fix test.support.catch_unraisable_exception(): __exit__() no longer
ignores unraisable exceptions.
Fix test_io test_writer_close_error_on_close(): use a second
catch_unraisable_exception() to catch the BufferedWriter unraisable
exception.
Diffstat (limited to 'Doc/library/test.rst')
-rw-r--r-- | Doc/library/test.rst | 10 |
1 files changed, 3 insertions, 7 deletions
diff --git a/Doc/library/test.rst b/Doc/library/test.rst index 0a98c88..920c018 100644 --- a/Doc/library/test.rst +++ b/Doc/library/test.rst @@ -1086,17 +1086,13 @@ The :mod:`test.support` module defines the following functions: Context manager catching unraisable exception using :func:`sys.unraisablehook`. - If the *object* attribute of the unraisable hook is set and the object is - being finalized, the object is resurrected because the context manager - stores a strong reference to it (``cm.unraisable.object``). - Storing the exception value (``cm.unraisable.exc_value``) creates a reference cycle. The reference cycle is broken explicitly when the context manager exits. - Exiting the context manager clears the stored unraisable exception. It can - trigger a new unraisable exception (ex: the resurrected object is finalized - again and raises the same exception): it is silently ignored in this case. + Storing the object (``cm.unraisable.object``) can resurrect it if it is set + to an object which is being finalized. Exiting the context manager clears + the stored object. Usage:: |