summaryrefslogtreecommitdiffstats
path: root/Doc
diff options
context:
space:
mode:
authorMiss Islington (bot) <31488909+miss-islington@users.noreply.github.com>2019-02-27 23:45:57 (GMT)
committerGitHub <noreply@github.com>2019-02-27 23:45:57 (GMT)
commita588343390356f5f7bb40e25371f0f2a092d6d72 (patch)
tree0cdc7cc1ebf8118b3b6e06f36be26310dc50cf53 /Doc
parent60ef9b05def9fd9e26959ffccc1811a32fb7dc0f (diff)
downloadcpython-a588343390356f5f7bb40e25371f0f2a092d6d72.zip
cpython-a588343390356f5f7bb40e25371f0f2a092d6d72.tar.gz
cpython-a588343390356f5f7bb40e25371f0f2a092d6d72.tar.bz2
Document the surprising sideeffect PyErr_Print(). (GH-12081)
Did you know an API documented as printing the pending traceback would sometimes exit the process? You do now. (cherry picked from commit 4173772031747a9b249be4100b4aa9eda805ea23) Co-authored-by: Gregory P. Smith <greg@krypto.org>
Diffstat (limited to 'Doc')
-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 db302d8..281e4c8 100644
--- a/Doc/c-api/exceptions.rst
+++ b/Doc/c-api/exceptions.rst
@@ -44,8 +44,12 @@ is a separate error indicator for each thread.
.. 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