summaryrefslogtreecommitdiff
path: root/Doc/whatsnew
diff options
context:
space:
mode:
authorVictor Stinner <vstinner@redhat.com>2019-05-22 11:28:22 +0200
committerGitHub <noreply@github.com>2019-05-22 11:28:22 +0200
commitef9d9b63129a2f243591db70e9a2dd53fab95d86 (patch)
tree3ecd9bb04fba6c9d360b8db5d8b1e78cda50d49b /Doc/whatsnew
parent2725cb01d7cbf5caecb51cc20d97ba324b09ce96 (diff)
downloadcpython-git-ef9d9b63129a2f243591db70e9a2dd53fab95d86.tar.gz
bpo-36829: Add sys.unraisablehook() (GH-13187)
Add new sys.unraisablehook() function which can be overridden to control how "unraisable exceptions" are handled. It is called when an exception has occurred but there is no way for Python to handle it. For example, when a destructor raises an exception or during garbage collection (gc.collect()). Changes: * Add an internal UnraisableHookArgs type used to pass arguments to sys.unraisablehook. * Add _PyErr_WriteUnraisableDefaultHook(). * The default hook now ignores exception on writing the traceback. * test_sys now uses unittest.main() to automatically discover tests: remove test_main(). * Add _PyErr_Init(). * Fix PyErr_WriteUnraisable(): hold a strong reference to sys.stderr while using it
Diffstat (limited to 'Doc/whatsnew')
-rw-r--r--Doc/whatsnew/3.8.rst10
1 files changed, 10 insertions, 0 deletions
diff --git a/Doc/whatsnew/3.8.rst b/Doc/whatsnew/3.8.rst
index 5f8208d5bf..63b8200a15 100644
--- a/Doc/whatsnew/3.8.rst
+++ b/Doc/whatsnew/3.8.rst
@@ -481,6 +481,16 @@ and manipulating normal distributions of a random variable.
[7.672102882379219, 12.000027119750287, 4.647488369766392]
+sys
+---
+
+Add new :func:`sys.unraisablehook` function which can be overridden to control
+how "unraisable exceptions" are handled. It is called when an exception has
+occurred but there is no way for Python to handle it. For example, when a
+destructor raises an exception or during garbage collection
+(:func:`gc.collect`).
+
+
tarfile
-------