Testing and Diagnostics Modules
sys.monitoring
Execution-event monitoring API exposed as sys.monitoring (Python 3.12+), not as an importable submodule. Tools reserve identifiers, register callbacks and enable global or code-local events. Release events and callback registrations before freeing an identifier so other instrumentation is not disturbed.
Formal Syntax & Structure
python syntaxpython
import syssys.monitoringReturn Value
namespace
Monitoring namespace exposed by sys; not a separately importable module.
Working Example
Example Snippetpython
import sysmonitor = sys.monitoringprint(monitor.events.PY_START != monitor.events.PY_RETURN)