summaryrefslogtreecommitdiffstats
path: root/Doc/c-api
diff options
context:
space:
mode:
authorGregory P. Smith <greg@krypto.org>2019-02-27 23:27:32 (GMT)
committerGitHub <noreply@github.com>2019-02-27 23:27:32 (GMT)
commit4173772031747a9b249be4100b4aa9eda805ea23 (patch)
tree16f60bc6f0b92abc1833a52553565f02053ab9c9 /Doc/c-api
parent4064089fce57c6fb2d1df9f3fb51d3fd5557696b (diff)
downloadcpython-4173772031747a9b249be4100b4aa9eda805ea23.zip
cpython-4173772031747a9b249be4100b4aa9eda805ea23.tar.gz
cpython-4173772031747a9b249be4100b4aa9eda805ea23.tar.bz2
Document the surprising sideeffect PyErr_Print(). (#12081)
Did you know an API documented as printing the pending traceback would sometimes exit the process? You do now.
Diffstat (limited to 'Doc/c-api')
-rw-r--r--Doc/c-api/exceptions.rst8
1 files changed, 6 insertions, 2 deletions
diff --git a/Doc/c-api/exceptions.rst b/Doc/c-api/exceptions.rst
index 6dd0c02..8c5f66c 100644
--- a/Doc/c-api/exceptions.rst
+++ b/Doc/c-api/exceptions.rst
@@ -53,8 +53,12 @@ Printing and clearing
.. c:function:: void PyErr_PrintEx(int set_sys_last_vars)
Print a standard traceback to ``sys.stderr`` and clear the error indicator.
- Call this function only when the error indicator is set. (Otherwise it will
- cause a fatal error!)
+ **Unless** the error is a ``SystemExit``. In that case the no traceback
+ is printed and Python process will exit with the error code specified by
+ the ``SystemExit`` instance.
+
+ Call this function **only** when the error indicator is set. Otherwise it
+ will cause a fatal error!
If *set_sys_last_vars* is nonzero, the variables :data:`sys.last_type`,
:data:`sys.last_value` and :data:`sys.last_traceback` will be set to the