After importing the samba module, SIGINT will no longer raise KeyboardInterrupt, but will rather quit the interpreter uncleanly (exception handlers and finally blocks won't run). This is due to the following code in source4/scripting/python/pyglue.c: /* one of the most annoying things about python scripts is that they don't die when you hit control-C. This fixes that sillyness. As we do all database operations using transactions, this is also safe. */ signal(SIGINT, SIG_DFL); The comment obviously doesn't apply to any Python code that might ever use the Python bindings. A library should not make global changes, especially when it's just imported. Removing the line is easy enough, but it will need to be added individually to all Samba utilities that expect it. Steps to Reproduce: run the following program, press Ctrl+C import samba try: while True: pass finally: print "Exiting properly" Actual Results: No message is printed Expected Results: "Exiting properly" and a traceback is printed
I've pushed a fix for this to autobuild.
Patch has been pushed to autobuild-v4-0-test also. Will be included in RC3.