Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 60da99b

Browse files
authored
bpo-32532: Improve documentation of settrace and setprofile (#5359)
Mention in the documentation of settrace and setprofile that errors in the registered handlers will cause themselves unset.
1 parent 61d478c commit 60da99b

1 file changed

Lines changed: 5 additions & 1 deletion

File tree

Doc/library/sys.rst

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1089,7 +1089,8 @@ always available.
10891089
but the return event is reported even when an exception has been set). The function is
10901090
thread-specific, but there is no way for the profiler to know about context switches between
10911091
threads, so it does not make sense to use this in the presence of multiple threads. Also,
1092-
its return value is not used, so it can simply return ``None``.
1092+
its return value is not used, so it can simply return ``None``. Error in the profile
1093+
function will cause itself unset.
10931094

10941095
Profile functions should have three arguments: *frame*, *event*, and
10951096
*arg*. *frame* is the current stack frame. *event* is a string: ``'call'``,
@@ -1173,6 +1174,9 @@ always available.
11731174
function for further tracing in that scope), or ``None`` to turn off tracing
11741175
in that scope.
11751176

1177+
If there is any error occurred in the trace function, it will be unset, just
1178+
like ``settrace(None)`` is called.
1179+
11761180
The events have the following meaning:
11771181

11781182
``'call'``

0 commit comments

Comments
 (0)