I propose to mention the behaviour that "if exception raised in tracefunc or profilefunc, the handler will be unset" in the documentation of sys.settrace and sys.setprofile. I encounter this behaviour and surprised by it since I can't get the info from the doc. Only by digging into the source code, I can find out why the profile messages suddenly disappear.
There are some issues in the documentation for this function (slightly related) to this described here: https://bugs.python.org/issue17799. I can update the PR linked to that issue with this information as well.
Hi Pablo, it would be nice. But for #17799, I don't know actually which part should be fixed, doc or code? I think it's better to consult gurus on python-dev mail list.