Skip to content

Commit ec5b28c

Browse files
committed
Clarify these functions aren't that safe
1 parent cedb1f3 commit ec5b28c

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

Doc/c-api/exceptions.rst

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1366,7 +1366,10 @@ Tracebacks
13661366
This function will return ``NULL`` on success, or an error message on error.
13671367
It will also write this error message to *fd*.
13681368
1369-
This function is safe to use from signal handlers.
1369+
This function is intended for use in crash scenarios such as signal handlers
1370+
for SIGSEGV, where the interpreter may be in an inconsistent state. Given
1371+
that it reads interpreter data structures that may be partially modified, the
1372+
function might produce incomplete output or it may even crash itself.
13701373
13711374
The caller does not need to hold an :term:`attached thread state`, nor does
13721375
*tstate* need to be attached.
@@ -1394,7 +1397,10 @@ Tracebacks
13941397
thread. It only writes the tracebacks of the first 100 threads, further
13951398
output is truncated with the line ``...``.
13961399
1397-
This function is safe to use from signal handlers.
1400+
This function is intended for use in crash scenarios such as signal handlers
1401+
for SIGSEGV, where the interpreter may be in an inconsistent state. Given
1402+
that it reads interpreter data structures that may be partially modified, the
1403+
function might produce incomplete output or it may even crash itself.
13981404
13991405
The caller does not need to hold an :term:`attached thread state`, nor does
14001406
*current_tstate* need to be attached.

0 commit comments

Comments
 (0)