Guido van Rossum <gu...@python.org> added the comment:

Ah, I think the docs need to be clarified a bit. Here's what I was missing:

The key thing to know here is that there are *three* state variables; 
`c_tracefunc`, `c_profilefunc` (on the thread state), and `use_tracing` (on the 
C frame).

Normally `use_tracing` is initialized to false if both functions are NULL, and 
true otherwise (if at least one of the functions is set).

*Disabling* means setting `use_tracing` to false regardless. *Resetting* means 
setting `use_tracing` to the value computed above.

There's also a fourth variable, `tstate->tracing`, which indicates whether a 
tracing function is active (i.e., it has been called and hasn't exited yet). 
This can be incremented and decremented. But none of the proposed APIs affect 
it.

Would it be reasonable to just put these APIs in pythoncapi_compat, instead of 
in the stdlib? (It would be yet one more selling point for people to start 
using that. :-)

----------

_______________________________________
Python tracker <rep...@bugs.python.org>
<https://bugs.python.org/issue43760>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to