Our Java debugger shows owned and waiting-on synchronization monitor ids for each thread, which helps a lot when debugging deadlocks. We're building a Python (CPython) debugger now and would like to do the same. Anyone know if there is a way to do this with the full control we have (launching the user program with exec() and the Python side of the debugger is our own)? Is it possible to subclass and replace the builtin lock and synchronization classes?