So the way Python does it is that it doesn&#x27;t call back into the interpreter loop from the signal handler.  That would be a really bad idea as you note, because the interpreter can call malloc and do all sorts of other stuff.<p>It queues your Python signal handling function, returns from the signal handler, and then runs it on the main loop at the next tick.<p>As far as I know this works fine.  I wrote the same program in Python and it seems to work just fine, and have more functionality than the Go version. I guess one problem is that if you do a long blocking syscall on a tick in the main loop, your signal handler can be delayed indefinitely.  There might be some hacks around this in the Python interpreter, but I don&#x27;t recall offhand.