Skip to content

Commit

Permalink
bpo-32532: Improve documentation of settrace and setprofile (python#5359
Browse files Browse the repository at this point in the history
)

Mention in the documentation of settrace and setprofile that errors in the
registered handlers will cause themselves unset.
  • Loading branch information
zhangyangyu authored Jan 27, 2018
1 parent 61d478c commit 60da99b
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion Doc/library/sys.rst
Original file line number Diff line number Diff line change
Expand Up @@ -1089,7 +1089,8 @@ always available.
but the return event is reported even when an exception has been set). The function is
thread-specific, but there is no way for the profiler to know about context switches between
threads, so it does not make sense to use this in the presence of multiple threads. Also,
its return value is not used, so it can simply return ``None``.
its return value is not used, so it can simply return ``None``. Error in the profile
function will cause itself unset.

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

If there is any error occurred in the trace function, it will be unset, just
like ``settrace(None)`` is called.

The events have the following meaning:

``'call'``
Expand Down

0 comments on commit 60da99b

Please sign in to comment.