The signal module should always be available on the currently supported platforms. Note that on Windows, the C runtime library just emulates a few signals, since Windows does not implement POSIX signals[1].
That’s not right. If the main thread exits normally back to Py_RunMain() or if it raises SystemExit, then Py_FinalizeEx() gets called, which, among other things, shuts down the threading module and calls Python atexit functions. If the process exits via C exit() or _exit(), then Py_FinalizeEx() isn’t called, so threading isn’t shut down and Python atexit functions aren’t called.
SIGBREAKandSIGINTare based on the corresponding console control events.SIGSEGV,SIGILL, andSIGFPEare based on the corresponding OS exceptions.SIGABRTandSIGTERMare emulated just for use with Craise()andabort(). There isn’t support in Python for handlingSIGSEGV,SIGILL,SIGFPE, andSIGABRTdue to the design of the C signal handler, which just sets a flag and returns. Also, handlingSIGINTandSIGBREAKis broken when reading from the console/terminal sinceEOFErroris raised instead of restarting the read. ↩︎