Python:sys
lastmod 2022-03-11created 2022-03-111 edits
APIs
settrace
Setting the system's trace function lets you implement a Python source code debugger in Python. The function is thread-specific; for a debugger to support multiple threads, it must register using settrace() for each thread being debugged.
gettrace
How to check whether you are currently debugging:
import sys
def debugger_is_active() -> bool:
"""Return if the debugger is currently active"""
gettrace = getattr(sys, 'gettrace', lambda : None)
return gettrace() is not None
audit
addaudithook
See also
Pages that link here