I have been reading about the sys.monitoring API that has been released for Python 3.12. I understand a bit of its working and can point sys.breakpointhook to my own function and print out simple debugging information. I now want to pause the execution of my script when I hit a breakpoint instead of just printing out information but cannot understand how this can be implemented. Let us just say, I am trying to implement a very basic debugger myself. I know that there are ready to use debuggers out there but I want to understand how they work so I would like to try and implement one myself. It would be great if someone could point out how Bdb does it as I have browsed the source but haven't figured out much. Is there a sys module call that is used to do this? Continue reading...