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.
SIGBREAK
andSIGINT
are based on the corresponding console control events.SIGSEGV
,SIGILL
, andSIGFPE
are based on the corresponding OS exceptions.SIGABRT
andSIGTERM
are emulated just for use with Craise()
andabort()
. There isn’t support in Python for handlingSIGSEGV
,SIGILL
,SIGFPE
, andSIGABRT
due to the design of the C signal handler, which just sets a flag and returns. Also, handlingSIGINT
andSIGBREAK
is broken when reading from the console/terminal sinceEOFError
is raised instead of restarting the read. ↩︎