8000 Document the surprising sideeffect PyErr_Print(). (GH-12081) · python/cpython@661151b · GitHub
[go: up one dir, main page]

Skip to content
8000

Commit 661151b

Browse files
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 4173772) Co-authored-by: Gregory P. Smith <greg@krypto.org>
1 parent 79e7259 commit 661151b

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

Doc/c-api/exceptions.rst

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,8 +53,12 @@ Printing and clearing
5353
.. c:function:: void PyErr_PrintEx(int set_sys_last_vars)
5454
5555
Print a standard traceback to ``sys.stderr`` and clear the error indicator.
56-
Call this function only when the error indicator is set. (Otherwise it will
57-
cause a fatal error!)
56+
**Unless** the error is a ``SystemExit``. In that case the no traceback
57+
is printed and Python process will exit with the error code specified by
58+
the ``SystemExit`` instance.
59+
60+
Call this function **only** when the error indicator is set. Otherwise it
61+
will cause a fatal error!
5862
5963
If *set_sys_last_vars* is nonzero, the variables :data:`sys.last_type`,
6064
:data:`sys.last_value` and :data:`sys.last_traceback` will be set to the

0 commit comments

Comments
 (0)
0